convert decimal value

yewmeng

Well-known member
Joined
Dec 16, 2003
Messages
46
hi all

let say i have a decimal value 12.314
i just want to show 12.31

so how to convert it
please help me thx in advance
 
C#:
double myVal

myVal = 12.318;
myVal = Math.Round(myVal, 2);

Code:
Dim myVal As Double

myVal = 12.318
myVal = Math.Round(myVal, 2)
 
Just note that ROUND will actually "round" your value. This mean that if the value is 1.38, ROUND(1.38,1)=1.4

if you dont wish to actually round the number something else must be made...

Alex :p
 
You can limit the display of digits using one of the string formatters:

eg. Label1.Text = Amount.ToString("F") - will display just two decimal places.
 


Write your reply...
Back
Top