Solved

Phone Number Validation VB.Net

Posted on 2008-10-28
2
1,744 Views
Last Modified: 2012-05-05
I already have a code snipet that validates the phone number is in the correct string format. I was wondering if anyone knew of a way to try and make sure the phone number is as valid as possible. ie the user did not enter all 111-111-1111 or 123-456-7890 and so on

Any thoughts ?
0
Comment
Question by:jimseiwert
2 Comments
 
LVL 16

Accepted Solution

by:
HooKooDooKu earned 500 total points
ID: 22824850
The proplem is that you are talking about a moving target.  A phone number (U.S.) consists of an Area code and what is known as an NXX and 4 more digits.  There is a limited set of valid Area Codes and NXX values.  But new area codes keep getting added all the time, and new NXX codes are getting added to each area code.

So to obtain what you are looking for, you would have to have some sort of service that updates what constitutes a valid value on a regular basis. (Such products do exist... as an example of what I could find with a quick search is www.area-codes.com).

On the other hand, you could right a simplistic subroutine to do a sanity check against current basic rules for phone nubers.  For example, the area code can't be any of the special numbers like 555, #11 (like 911 and 411) & 999, and no area codes start with 1.  Do some Googling on Area code lists or NXX lists and you'll find additional information.
0
 
LVL 48

Expert Comment

by:jpaulino
ID: 22824867
You can use a maskedtextbox for that. It will make the validation for you.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now