Click here to Skip to main content
15,896,201 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
validation code for phone number in visual studio 2005 c#.net code project
Posted

There are many ways you can accomplish phone number validation, from regular expressions through to string checking, but they are all going to suffer from the same problem. You haven't defined here what format of phone numbers you want to validate. A phone number here, in the UK, is a different format to a US phone number, so what works here would be absolutely no use to validating a US number.
 
Share this answer
 
Regex is an option, if you compare the input with a valid regex formula for the telephone format of your country then that would be a good way.

Like Pete said, you need define a format of the numbers you want to validate.
 
Share this answer
 
I have found a very good article for phone number validation.

hope it helps :)


http://blog.stevenlevithan.com/archives/validate-phone-number
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900