Link to home
Start Free TrialLog in
Avatar of qwertzu
qwertzu

asked on

How to use round() correctly

I´v problems using round() in my VB4.0:
When I use x=round(5,34) then the compiler says:" Wrong
amount of arugment..."
Do I need to load a Math-Liabrary or s.th.
Please answer with a working example!!!
Avatar of viktornet
viktornet
Flag of United States of America image

Can't you use

x = Round(34)

???

Regards,
Viktor Ivanov

Avatar of a111a111a111
a111a111a111

What are you trying to do , what are the numbers 5,34?
If you ask for mod coze you have 2 numbers here is your answer:

This example uses the Mod operator to divide two numbers and return only the remainder. If either number is a floating-point number, it is first rounded to an integer.

Dim MyResult
MyResult = 10 Mod 5      ' Returns 0.
MyResult = 10 Mod 3      ' Returns 1.
MyResult = 12 Mod 4.3      ' Returns 0.
MyResult = 12.6 Mod 5      ' Returns 3.

If you trying something else let us know.
If you are trying to round a number to an integer then use this

Int(34.45)

Regards,
Viktor Ivanov
ASKER CERTIFIED SOLUTION
Avatar of Dalin
Dalin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ain't the answer same as my suggestion??? =|

Regards,
Viktor Ivanov
Even though I'm not a VB programmer, I think there is no such function as Round in VB...
Correct me if I'm wrong...What I mean a function that is called Round....Int() function rounds off the float number to an integer =)

Regards,
Viktor Ivanov
Hi, all,
I think viktornet is right. Round may not be a VB function. I have used it before but I had crystal report. I try to look for it but I do not have VB4 anymore.

I am sorry if I misled any of you, and I appologize for my mistake.

Qwertzu, it looked like you have the function based on the error message you have, If you don't have the function, you should get an error message saying "function not defined" or somrthing like that, rather than wrong number of argument. You can search the On-line help in your VB IDE.

Regards to all.
Dalin