July 17th, 2013, 01:23 AM

Find rounding functions VB6.0 ?
I want to find rounding functions. In VB60. The function can be fulfilled in the for example below
for example:
794.5 = 795
843.4 = 843
245.345 = 245
I used the function: Round(), Int(), Fix() but not.
July 18th, 2013, 10:44 AM

Based on the numbers you provided, you want to round a single precision number to the nearest whole number. The "Int" function simply truncates the result.
Code:
Private Sub cmdRound_Click()
Text1.Text = Int(Text1.Text + 0.5)
Text2.Text = Int(Text2.Text + 0.5)
Text3.Text = Int(Text3.Text + 0.5)
End Sub
The same technique can be used for other significant numbers by multiplying or dividing by powers of 10.
J.A. Coutts
August 14th, 2013, 06:00 AM

Originally Posted by couttsj
Based on the numbers you provided, you want to round a single precision number to the nearest whole number. The "Int" function simply truncates the result.
Code:
Private Sub cmdRound_Click()
Text1.Text = Int(Text1.Text + 0.5)
Text2.Text = Int(Text2.Text + 0.5)
Text3.Text = Int(Text3.Text + 0.5)
End Sub
The same technique can be used for other significant numbers by multiplying or dividing by powers of 10.
J.A. Coutts
Hi Coutts
apart from multiplying or dividing is their any other formula for this.
August 14th, 2013, 02:17 PM

Originally Posted by PeterSullivan
Hi Coutts
apart from multiplying or dividing is their any other formula for this.
For single or double precision numbers, you can use the Round function to adjust the number of decimal places. There is no function for rounding numbers to the left of the decimal place.
J.A. Coutts
August 15th, 2013, 07:38 PM

I don't know if this kb article will be helpful, but it looks to be a pretty complete discussion of rounding and different types of rounding.
http://support.microsoft.com/kb/196652
======
Doug G
======
Bartender to Rene Descartes "have another beer?" Descartes: "I think not" and he vanished.
Alfred Bester