[2005] validating input fields
hello all,
I am setting up validation for my addrec form. I already have the validation to check if the box is blank, but I'm having trouble with validating the actual data input.
For example, I need the first field, state, to be two-letters only. I also need to make sure the second field is a four digit number only.
I tried looking at regular expressions, but they are somewhat confusing.
Re: [2005] validating input fields
Re: [2005] validating input fields
There are various ways you can limit the user to only enter the correct data. One of those is to use the proper controls for the expected data. For example, if you're to limit the user to enter only 2 letters for state, it'll be better to use a combobox that contains only valid state abbreviations. To limit user to enter only numeric data, you can use a numericupdown control or a maskedtextbox. If you still insist on using textboxes for everything, you can set the maxlength property to limit the number of characters can be typed to them, and handle one of the textbox's keyboard event to perform your own data validation.
Re: [2005] validating input fields
thank you for your response.
I already have the field set up for two digits only. What I want to know is, what kind of code do I use to make sure they only enter two letters?