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)