Results 1 to 4 of 4

Thread: Validating

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2011
    Posts
    10

    Validating

    I'm trying to verify 3 things: Email, Full Name, and Social Security number.

    Here's an example of what I'm trying to do:

    Email: [email protected]
    Full Name: John J Smith
    SSN: 123-45-6789

    ID: JJS6789

    I'm trying to have the Initials of the name, and the last four digits of the SSN, show where it says "ID." The ID is in a label.

    All 3 are written in Textboxes.

    I also have to verify if each one is written correctly with a picImage next to each textboxes.

    I don't even know where to start. I know I'm suppose to be using either the Right, or Mid function. And even the Len function.

    I am also using Visual Studio 2003, and using basic coding and functions.
    Last edited by tooshig; Dec 1st, 2011 at 07:15 PM.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Verifying

    I think that "validate" is a more accurate term than "verify". The first thing you need to do with regards to validation is determine exactly what the rules are. So, what are your rules?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    New Member
    Join Date
    Sep 2011
    Posts
    10

    Re: Verifying

    The rules for email is that it has to be one or more characters followed by “@” followed by one or more characters followed by a “.” Followed by com, org, net, etc.

    The rules for SSN is that it will test to see if the SSN is in valid format: three digit number followed by a dash followed by a two digit number followed by a dash followed by a three digit number.

    For the name, a First name and Last name have to be present.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Validating

    With regards to the email, your best bet is probably to use a regular expression. There are lots of examples available on the web, some more complex than others.

    With regards to the name, you can call String.Split and check that the Length of the array is greater than 1. That said, separate fields for given name, family name and other names might be a better option.

    With regards to the SSN, I was going to suggest a MaskedTextBox. In .NET 1.x there is only an ActiveX version, which is usable but a pain. There is a .NET version in .NET 2.0 and later. Is there a specific reason you're using VS.NET 2003? Can you not upgrade to a newer version? The Express editions are free.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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