|
-
Dec 1st, 2011, 07:11 PM
#1
Thread Starter
New Member
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.
-
Dec 1st, 2011, 07:50 PM
#2
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?
-
Dec 1st, 2011, 07:54 PM
#3
Thread Starter
New Member
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.
-
Dec 1st, 2011, 10:18 PM
#4
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|