rounding decimal place..

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

HI all

I would like to round up a double number, for example, 100.689 and round up to 100.6
i know i can do it with Round function. However, it doesn't show the any decimal place if the number is 100. I would like to show the decimal places even though they are 100.00.

Thanks
 
Ken,
Have you looked at formatting the number for display?

Depending on where you are displaying the number how you format it may
change. However the format string itself will remain the same...

Review the "Formatting Types" section of MSDN.

http://msdn.microsoft.com/library/d...y/en-us/cpguide/html/cpconformattingtypes.asp

Specifically Standard Numeric Format Strings:
http://msdn.microsoft.com/library/d...de/html/cpconstandardnumericformatstrings.asp

For example, you can pass one of the above format strings to the
Double.ToString method.

Dim d As Double = 100.689
Dim s As String = d.ToString("N2")

Hope this helps
Jay

Ken said:
HI all,

I would like to round up a double number, for example, 100.689 and round up to 100.69
i know i can do it with Round function. However, it doesn't show the any
decimal place if the number is 100. I would like to show the decimal places
even though they are 100.00.
 
Back
Top