Click here to Skip to main content
15,896,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to check text entered in textbox on button click.

The Format Should be like this XXXX-XXXX(2012-2013).

thx in advance ....
Posted

You can use MaskedTextBox for this purpose

You can find the various mask characters and help on MaskedTextBox here

http://msdn.microsoft.com/en-us/library/system.windows.forms.maskedtextbox.mask.aspx[^]

Other option is to check with regular expressions like this
C#
Regex.IsMatch(TextBox1.Text,@"[A-Z]{4}\-[A-Z]{4}\(2012\-2013\)")


If your problem is solved, you may accept the solution otherwise please post your queries
 
Share this answer
 
Comments
Ravi Sargam 23-Feb-12 6:28am    
thx.... can u search for thix question n give me answer "DataGridView with Inner DataGridView for Windows forms"

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