Decimal problem

  • Thread starter Thread starter Jeff
  • Start date Start date
J

Jeff

hey

ASP.NET 2.0

I'm created a webpage which displays money information. I mean it displays
amount of money like this:
23
32,6
456
1,5

The variable holding the amount is of DataType Double

As you see from the numbers above, some numbers have decimal and some
don't.. I would like to give all amount 2 digit decimals.. any suggestions
on how to do this?
 
Jeff said:
hey

ASP.NET 2.0

I'm created a webpage which displays money information. I mean it displays
amount of money like this:
23
32,6
456
1,5

The variable holding the amount is of DataType Double

As you see from the numbers above, some numbers have decimal and some
don't.. I would like to give all amount 2 digit decimals.. any suggestions
on how to do this?

Specify the format when you convert the value to a string:

amount.ToString("N2")
 
Back
Top