1) when any character except numbers in entered give a TRUE value to
e.Handled,so the event will ignore the character,and that is by comparing the
ASCII of the character with numbers ASCII.
2)but a try catch blocks and parse the textbox text to integer in try block
,so it will go to the catch block when there is charactres other than numbers
entered, now in the catch block you should empty the text property in the
textbox, the result will be emptying the textbox when non-numbers characters
are entered.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.