Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hello all, I have a databound da

Status
Not open for further replies.

BigRedTexas

Programmer
Mar 14, 2002
22
0
0
US
Hello all,

I have a databound datagrid that is pulling a string field filled with phone numbers. The problem I'm having is formatting the phone numbers to look like 999-999-9999. I have seen plenty examples of using the "Data Formatting Expression" in the datagrid columns properties for dates, currency, and time. However, there are no good examples of how to do this to a string.

I've looked everywhere on Microsoft's site and other places and still have no answer. If you can give me a solution, you'll be my hero!

Thanks, Scott
 
You might try formating the data at the source, then you don't have to worry about it later. There is information about Creating Custom Format Strings (see Adding Custom Format Strings for Custom Types)
 
Another way would be to use Regular Expressions. Daren J. Lahey
Just another computer guy...
 
Can you please explain what you mean "Regular Expressions".
 
Another thing you want to do is search in the vs.net help or on the support.microsoft.com site for:

Regular Expression
RegEx Syntax
RegEx.Replace

I am sure you will find what you need.

Good luck! Daren J. Lahey
Just another computer guy...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top