key press event in .net

G

Guest

I am developing an application in .net. I have various textboxes on the
forms and need to include data validation, or at least restrict the users
input. How do I go about allowing only letters to be entered into a textbox
using the above mentioned event? Further, I want to allow only numbers and
letters to be entered in. I don't want to enter in e.keychar="!" orelse
e.keychar=">", etc. I have converted the contents to uppercase already.

Thanks,
Dave
 
J

Jon Shemitz

dave said:
I am developing an application in .net. I have various textboxes on the
forms and need to include data validation, or at least restrict the users
input. How do I go about allowing only letters to be entered into a textbox
using the above mentioned event? Further, I want to allow only numbers and
letters to be entered in. I don't want to enter in e.keychar="!" orelse
e.keychar=">", etc. I have converted the contents to uppercase already.

Char.IsLetterOrDigit()
 
C

Cor Ligthert

Dave,

In addition to Jon, I use forever for this kind of operations the Key up to
get as much as posible possibilities from the eventargument.

I hope this helps,

Cor
 

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