Solved

How to use round() correctly

Posted on 1998-08-23
8
158 Views
Last Modified: 2010-04-30
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!!!
0
Comment
Question by:qwertzu
  • 4
  • 2
  • 2
8 Comments
 
LVL 10

Expert Comment

by:viktornet
ID: 1430559
Can't you use

x = Round(34)

???

Regards,
Viktor Ivanov

0
 
LVL 3

Expert Comment

by:a111a111a111
ID: 1430560
What are you trying to do , what are the numbers 5,34?
0
 
LVL 3

Expert Comment

by:a111a111a111
ID: 1430561
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.
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 10

Expert Comment

by:viktornet
ID: 1430562
If you are trying to round a number to an integer then use this

Int(34.45)

Regards,
Viktor Ivanov
0
 
LVL 9

Accepted Solution

by:
Dalin earned 50 total points
ID: 1430563
qwertzu,
Round is a vb function, does not require any other lib.

Dim x as Integer

x= round(5.34) ' return 5
x= round(5.57)  ' return 6.

Your code looked like x= round(5,34). I think that is the problem. You can only pass one number to this function.

Regards
Dalin
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1430564
Ain't the answer same as my suggestion??? =|

Regards,
Viktor Ivanov
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1430565
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
0
 
LVL 9

Expert Comment

by:Dalin
ID: 1430566
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



0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Saving history changes to sub form 4 48
TT Auto Dashboard 13 95
Help me. 3 60
VBA: Insert New column with specific format type 12 39
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question