Format a US Telephone number given any string.

Category:
String Manipulation
Type:
Snippets
Difficulty:
Intermediate
Author:
Andrew Ells-O'Brien

Version Compatibility: Visual Basic 6

More information:
This code is useful when you don't want to or can't use a masked edit control. To use it: pass it a string of numbers in any particular format and it will return the format of "(###) ###-####". If you pase it a number it can not figure out, it will simply return what you passed it.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: