Use
yourNumber.ToString(".00######")
Pregunta
Possible Duplicate:
Display Float as String with at Least 1 Decimal Place
Given the following values:
How can I achieve the following display:
What I am trying to do is force 2 decimal places UNLESS there are more "significant" digits, in which case I'd like to show them as well.
Note: The value is currently stored as a Decimal?
Solución
Use
yourNumber.ToString(".00######")