dragon4spy
10-01-2003, 01:38 AM
Hi! i've tried to pass byte array to a argument (variant array) of a sub, but then i got a type mismatch error. please help me, i don't want to duplicate the sub for each type. To make sure you can understand my english, i include the example for you. Please help me... :confused:
Sub Main()
Dim a() as Byte
Test a() '<------- Type mismatch error
End Sub
Sub Test(Arr())
'Codes
End Sub
Flyguy
10-01-2003, 02:07 AM
You are passing a byte array not a variant.
You should declare your function like this:
Private Sub Test(Arr() As Byte)
End Sub
gundavarapu
10-01-2003, 02:07 AM
try this...
Sub Main()
Dim a() As variant
Test a '<------- now it should be ok
End Sub
Sub Test(Arr() as variant)
'Codes
End Sub
dragon4spy
10-01-2003, 02:11 AM
You are passing a byte array not a variant.
You should declare your function like this:
Private Sub Test(Arr() As Byte)
End Sub
But i want only one sub/function can handle any array type. no duplications. Thanks anyway ;-)
Flyguy
10-01-2003, 02:12 AM
If you want this strange way of coding then make all variables/arrays Variants too. No need for using strong data types.