OIn one of the forms, I want to validate :
1.A TextBox(which will only accept digits 0-9)(the user won't be able top type any other except digits
2. Another textbox which will accept only [a-z} and [A-Z ], No other key will be allowed to be types in the textbox.
For the first requirement I used
Expand|Select|Wrap|Line Numbers
- System.Text.RegularExpressions.Regex myRegEx = new System.Text.RegularExpressions.Regex("^?{10}$");
- if (myRegEx.IsMatch(txtBox.text)) {
- // Is ok
- }
- else {
- // Is not ok
- }
kindly suggest a smarter way to validate.
Your answers would be appreciated.
Thanks in advance.