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 Zero Values?

Status
Not open for further replies.

Mongr1l

Programmer
Mar 6, 2006
179
US
I have a label control that is bound to a field on a table in a dataset. The field is of type decimal.

I'm trying to format the field such that it shows 8 decimal places -> ds.somefld.ToString("0.00000000")

This works fine so long as there is a value greater than Zero. However, if the value is zero, all that shows is: "0".

Is there an easy way to resolve this?

mongr1l
 
I believe the following will format 0 correctly:

Code:
String.Format ("{0:F8}", 0)

--Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top