?
Solved

Phone Number Validation VB.Net

Posted on 2008-10-28
2
Medium Priority
?
1,760 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 16

Accepted Solution

by:
HooKooDooKu earned 2000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

800 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