Results 1 to 4 of 4

Thread: [2005] validating input fields

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2006
    Location
    Between Try & Catch
    Posts
    249

    [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.
    Last edited by Blakk_Majik; Apr 10th, 2008 at 10:53 AM.

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Dec 2006
    Location
    Between Try & Catch
    Posts
    249

    Re: [2005] validating input fields

    Anyone?

  3. #3
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    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.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Dec 2006
    Location
    Between Try & Catch
    Posts
    249

    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?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width