John
Try this two events.
private void textBox1_KeyPress(object sender,
System.Windows.Forms.KeyPressEventArgs e)
{
//allow only digits and decimal
if((char.IsDigit(e.KeyChar) ==true) || (e.KeyChar == '.'))
e.Handled = false;
else
e.Handled = true;
}
private void textBox1_Leave(object sender, System.EventArgs e)
{
//handle special case validation while leaving the text box.
double number = Convert.ToDouble(textBox2.Text.Trim());
if((number < 0.010) || (number > 1.25))
MessageBox.Show("Invalid entry");
}
Shak
"John Sutor" <jo********@cinfin.com> wrote in message
news:e2**************@TK2MSFTNGP10.phx.gbl...
Here is te problem. I have a text box that I only allow numbers or
decimals to be entered (using an event delegate). The max number of characters I
allow is 4. The highest number that they should be able to enter is 1.25
and the lowest is 0.010. Currently I check the field when the leave the
control, but I need to not allow them to enter "9999" when they are typing
and not ust when they leave. Can anyone think of a way to do this?