Hi,
Is it possible in VB to pass a control array reference as an argument to a procedure? For example, to pass a standard array you would do this:
Sub Command1_Click()
Dim MyArr(9) as Integer
MyArr(7) = 10
ShowElement MyArr
End Sub
Sub ShowElement(Arr() as Integer)
MsgBox Arr(7) 'Displays 10
End Sub
But when I Dim MyArr(9) as TextBox, and update the argument ShowElement is expecting, the ShowElement call raises the error: Type Mismatch, Array or UDT expected. I've tried several variations of this to no avail (including passing the first element in the array). I'm currently looking into declaring a module level array of dummy textboxes, and set them to the text box array I want the sub to work with just before the procedure call, but I'm not sure that will work either. Is it possible to pass a control array to a procedure this way, and if so, what is the proper syntax?
Thanks!
-Mike
Difference between a madman and a genius:
A madman uses his genius destructively,
A genius uses his madness constructively.
Is it possible in VB to pass a control array reference as an argument to a procedure? For example, to pass a standard array you would do this:
Sub Command1_Click()
Dim MyArr(9) as Integer
MyArr(7) = 10
ShowElement MyArr
End Sub
Sub ShowElement(Arr() as Integer)
MsgBox Arr(7) 'Displays 10
End Sub
But when I Dim MyArr(9) as TextBox, and update the argument ShowElement is expecting, the ShowElement call raises the error: Type Mismatch, Array or UDT expected. I've tried several variations of this to no avail (including passing the first element in the array). I'm currently looking into declaring a module level array of dummy textboxes, and set them to the text box array I want the sub to work with just before the procedure call, but I'm not sure that will work either. Is it possible to pass a control array to a procedure this way, and if so, what is the proper syntax?
Thanks!
-Mike
Difference between a madman and a genius:
A madman uses his genius destructively,
A genius uses his madness constructively.