How to cancel a keystroke

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.
 
E

Earl

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

Ask a Question

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.

Ask a Question

Top