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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formatting percentages with StdDataFormat

Status
Not open for further replies.

BeerFreak

Programmer
Jul 3, 2001
5
US
I need to format a long decimal number (say 0.038375791) as a percentage with four decimal places (ie: 3.8375). I'm displaying the numbers in a MS DataGrid control that has a DataFormat property.

As I understand it, if I use the standard "Percent" format it always displays two decimal places. I figured if I could use the Format event of the StdDataFormat object I could write my own custom formatting, but I don't know where to find the Format event.

Anyone have some ideas? Thanks much.
 
Dim dFourPlaces as double

dFourPlaces = format(MyUnformattedNumber,"#.####")
 
Thanks for the reply, but that doesn't work when formatting numbers in a grid where the DataSource is a table on a database. I'll check to see if my OLE DB Provider supports a format function, but I'd really like to understand how StdDataFormat works.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top