A
Andrew Ducker
I have a subclass of TextBox, and I want to check that whenever the
text is changed the information in there is still a valid number.
I thought that overriding KeyPress with the following would work:
string oldText = this.Text;
base.OnKeyPress (e);
try
{
decimal.Parse(this.Text);
}
catch
{
this.Text = oldText;
}
but OnKeyPress doesn't seem to be where the change occurs. Any
suggestions as to which method actually updates the .Text property?
Thanks,
Andy D
text is changed the information in there is still a valid number.
I thought that overriding KeyPress with the following would work:
string oldText = this.Text;
base.OnKeyPress (e);
try
{
decimal.Parse(this.Text);
}
catch
{
this.Text = oldText;
}
but OnKeyPress doesn't seem to be where the change occurs. Any
suggestions as to which method actually updates the .Text property?
Thanks,
Andy D