Phone Number Format??

Glitterati

Member
Joined
Mar 17, 2006
Messages
13
Programming Experience
Beginner
I have a datagrid that is populated with contact information. The phone number gets populated as 1234567890. I have been unable to find how to format that as (123) 456-7890. Can anyone help????

Thanks!
 
There are a few 3rd party tools that allow you to enter the data like that but then save it as 1234567890. Janusys.com is one I really like. Pricey though but demo is free to use on your development machine

You can also try the format function. I think it would be
textbox1.text = format(phone_num, "(###) ###-####")

Remember, you need a # to represent each character in the phone number. If you store the 1 prefix for area codes, you need to put that in there too.
 
As mentioned, the following would do the trick:

Dim i As Long = 123456789
i.ToString("(###) ###-###")

But ideally as you are using a datagrid you should do the formatting at the database level.
 
Back
Top