I want to filter the keyboard inputs into textbox based on the type of input I allow. e.g.
0 for Digits only
1 for Alphabets only
2 for Alphanumerics
So if 0 is configured and a character ‘a’ is pressed on the keyboard, it is not shown in the textbox. How do I do that in C#?
Thanks
You need to subscribe to control’s KeyPress event (and optionally KeyDown method), and if key stroke must be eaten set Handled property to true. Read more in msdn (with sample that cover your problem).