how can I write aevent procedure code to round a number to two decimals?
I am wrighting something similer to this
a=val(x)+val(Y)
I Know in exel "Round,2" Makes a number to Two Decimals.
Printable View
how can I write aevent procedure code to round a number to two decimals?
I am wrighting something similer to this
a=val(x)+val(Y)
I Know in exel "Round,2" Makes a number to Two Decimals.
Use the Math.Round method, e.g.VB Code:
Dim myDouble As Double = 1.23456789 myDouble = Math.Round(myDouble, 2) MessageBox.Show(myDouble.ToString()) 'Displays 1.23 myDouble = 9.87654321 myDouble = Math.Round(myDouble, 2) MessageBox.Show(myDouble.ToString()) 'Displays 9.88