Thursday, November 11, 2010

How do I round down a decimal number thats the result of an equation based on user entered information in VB?

Im developing a calculator that soloves a hard equation based on user's information. I need to know how to round down a decimal number thats the result of the equation and its shown in a label in the main form. Thanks for help :)How do I round down a decimal number thats the result of an equation based on user entered information in VB?
use Math.Floor



Ex.



Dim number As Double = 2.5

Dim roundedNumber as Double = Math.Floor(number)



The same can be done with any other floating point number.How do I round down a decimal number thats the result of an equation based on user entered information in VB?
...or Math.Round if you want more freedom on the precision.

No comments:

Post a Comment