Click here to Skip to main content
14,661,186 members
Rate this:
Please Sign up or sign in to vote.
See more:
I have a textbox that the user can only enter characters in a certain order into to enable a button. I would like it to be like this: (N = 'number' and L = 'letter')
IF textBox1 contains character order of (NNNNNLNN-NNNL-NNLL-NLNN-LNNLLLNNLLLL)
    { button1.Enabled = true; }
ELSE { button1.Enabled = false; }

So I want to enable the button if the order and amount of letters, numbers and dashes is in the correct combination of NNNNNLNN-NNNL-NNLL-NLNN-LNNLLLNNLLLL. How would I do this in C#. Thanks
Posted
Comments
BillWoodruff 5-Oct-13 21:34pm
   
What have you tried so far ? Is this WinForms ? ASP.NET ?

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

I recommend using Regex to determine this.  See this[^] awesome Regex tutorial and this[^] page to test your Regex expression.

/ravi
   
Comments
BillWoodruff 7-Oct-13 0:30am
   
Those are excellent resources, Ravi.

thanks, Bill

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100