I want to limit the user to just type the numbers in the text box I add this code to a keypress event:
Private zero txtPartID_KeyPress (Object Sender, KeyPressEventArgs e) {if (((e.KeyChar> = '0') & amp; ; KeyChar & lt; = '9')) == incorrect) {e.Handled = true; }}
But then backspace key does not work for that text box. How can I change it?
You can check backspace using this,
If there is a better way to check for numbers (e.KeyChar == '\ b')
Private zero txtPartID_KeyPress (object) sender , Keypress EventAgages E) {E. Handle =! (Fourth ISN (E. Checher) || E.Kerk == 8); }
No comments:
Post a Comment