Link to home
Start Free TrialLog in
Avatar of Albeej221
Albeej221

asked on

Help Validate Phone Number Using IdexOf, IsNumeric and Substrings

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


Avatar of Jens Fiederer
Jens Fiederer
Flag of United States of America image

This looks like a homework assignment...real-life problems don't have such restrictions.

We can help you out if you are having a specific problem - where is the difficulty?  Do you not understand how to use substrings?

But we can't do your homework for you.
Avatar of Albeej221
Albeej221

ASKER

It is indeed, I didn't expect it to be done for me. :)

I am just having a hard time getting started. I don't understand how to incorporate the indexOf and how to assign the substrings....
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you Idle,

seeing it in that context does help me to see the IndexOf's function/purpose.

Johanna