yewmeng Posted March 2, 2004 Posted March 2, 2004 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 Quote
bri189a Posted March 3, 2004 Posted March 3, 2004 double myVal myVal = 12.318; myVal = Math.Round(myVal, 2); Dim myVal As Double myVal = 12.318 myVal = Math.Round(myVal, 2) Quote
AlexCode Posted March 3, 2004 Posted March 3, 2004 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 don't wish to actually round the number something else must be made... Alex :p Quote Software bugs are impossible to detect by anybody except the end user.
kas Posted March 4, 2004 Posted March 4, 2004 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. Quote
AlexCode Posted March 4, 2004 Posted March 4, 2004 Usually I use the Substring for that... Alex :p Quote Software bugs are impossible to detect by anybody except the end user.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.