Click here to Skip to main content
15,915,513 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI sir,
please help me sir, How can i validate numeric numbers and special characters from Masked Text Box(Allow only Alphabets)in windows Application !!
Posted
Updated 8-Apr-12 22:32pm
v2

Have a RegularExpressionValidator with proper regular expression validating the textbox.
 
Share this answer
 
v2
Comments
Prasad_Kulkarni 9-Apr-12 4:18am    
In c++??
Rahul Rajat Singh 9-Apr-12 4:19am    
Well still you could use regular expression fro validation. there will not be any control for that but since it is a windows application you should be able to do it.
Prasad_Kulkarni 9-Apr-12 4:23am    
I wasn't knowing it sir, that's really great info. +5
But if your requirement is to allow only alphabet in the MaskedTextBox then I think you can consider using mask character ? in the Mask property
C#
MaskedTextBox1.Mask = "???????";

The ? charcater allows a
Letter, optional. Restricts input to the ASCII letters a-z and A-Z. This mask element is equivalent to [a-zA-Z]? in regular expressions. as explained here.
Mask elements for Mask property of MaskedTextBox[^]
 
Share this answer
 
I did a search on the internet and found this[^], maybe it will be useful to you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900