I created a text box event handler to only allow my textbox to accept Numbers only. The Event handler works great and does not allow anything but numbers except when the form first loads and the character entered is non-numeric it then allows the first charcter to be entered can be non-numberic. If I enter a number then erase it it will not allow a non-numeric character.
I saw one example of this but the texbox had a underline in it but it did not have any code in it.
Here is my event handler right now.
private void rtbQuantity_TextChanged(object sender, EventArgs e)
{
rtbQuantity.KeyPress += new KeyPressEventHandler(rtbQuantity_KeyPress);
}
private void rtbQuantity_KeyPress(object sender, KeyPressEventArgs e)
{
if ((e.KeyChar < '0') || (e.KeyChar > '9')) e.Handled = true;
}
Thank you