Solved

Phone Number Validation VB.Net

Posted on 2008-10-28
2
1,753 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 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Suggested Solutions

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

738 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