How to cancel a keystroke

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello, guys,

How can we cancel a keystroke when a user types an invalid character in a
text box? For example, in a number only text box, a user types a letter, or
in a capital letter only text box, a user types a number or lower case letter.

Thanks.
 
Use one of the key events, such as KeyUp, parse for the keystroke you want
to cancel and set e.Cancel = True.
 
Back
Top