Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why ByRef argument type mismatch? 1

Status
Not open for further replies.

Motor11

Technical User
Jul 30, 2002
60
US
I have an argument type mismatch, but I believe all variables are of matching types. Any ideas why this might be occuring?

How the variables are defined in the calling subroutine:
Dim x_small, y_small, x_large, y_large As Double
Dim xmid, ymid As Double
Dim x_adjust, y_adjust As Double

How I call the subroutine (this is the line that returns the errors):
Call drawgrid(x_small, y_small, xmid, ymid, centerx, centery, x_adjust, y_adjust)


The offending subroutine:
Public Sub drawgrid(x_small As Double, y_small As Double, xmid As Double, ymid As Double, _
centerx As Double, centery As Double, x_adjust As Double, y_adjust As Double)

Mainform.scatter.Line (x_small + 0.2, y_small)-(x_small + 0.2, y_large - 0.05)
Mainform.scatter.CurrentX = x_small + 0.1
Mainform.scatter.CurrentY = y_large
tester = g2p((x_small + 0.2), x_adjust)
Mainform.scatter.Print Format(tester, "0.00")
end sub

Note: I am using VB 5 for this project.

Best regards,
Ryan
 
A couple of things - you might want to try explicitly declaring each variable as double

Dim x_small as Double, y_small as Double, x_large as Double, y_large As Double
Dim xmid as Double, ymid As Double
Dim x_adjust as Double, y_adjust As Double

Also, although probably an oversight on the post, I would also verify that centerx and centery or both explicitly declared as doubles. Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
CajunCenturion

Thanks, you were correct, I was apparently defining my variables incorrectly. I'll change to your suggested method:

dim x as double, y as double

as opposed to

dim x, y as double

Best regards,
Ryan
 
You will find that

Code:
dim x, y as double
dims x as a variant and dims y as a double Let me know if this helps
________________________________________________________________
If you are worried about how to post, please check out FAQ222-2244 first

'There are 10 kinds of people in the world: those who understand binary, and those who don't.'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top