Help Validate Phone Number Using IdexOf, IsNumeric and Substrings
Posted on 2006-05-02
I need some help getting pointed in the right direction. I have to create a program that validates phone numbers, but I have to use the following criteria in it. I need to use substrings to break the number down into 3 groups "999", "999", "9999". I have to use the IndexOf and IsNumeric Functions of VB.net. I cannot use any other functions except those listed.
_**The application should accept a maximum of 12 characters. When the user clicks a button, the program should determine if the entry is of the form 999-999-9999, where the character 9 represents any number. "
"Check that the user has entered two dashes in the appropriate spaces.
-**Break the string into 3 substrings, represented as 999,999, and 9999.
-**Check that the user has entered two dashes in the appropriate spaces.
-**Check to see if each part is only numeric characters, using IsNumeric and IndexOf.
If error, display error message box.
-**You don’t have to use loops (you can if you want to), but you have to use the if-then-else statement