|
-
January 21st, 2009, 10:49 AM
#1
"byref argument type mismatch"
I always thought that (x&) is passable as an argument to a Sub expecting (x As Long)!
I was wrong (I think!).
I got the dreaded "byref argument type mismatch" from this code:
Private Sub Form_Load()
Dim txt$
txt$ = "12345"
dim i as long
i = 100
Call ci(txt$, 1, i)
End Sub
Sub ci(txt$, Optional x&, Optional y&)
' do something
End Sub
The error seems to occur before i assumes any value.
I solved it by either this:
Dim i&
OR this:
Sub ci(txt$, Optional x AS LONG, Optional y AS LONG)
In other word, (&) and (AS LONG) do NOT seem to be equal!
Please explain! (I use VB6)
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|