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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send array of controls as arguments to Sub

Status
Not open for further replies.

elibb

Programmer
Joined
Oct 22, 2001
Messages
335
Location
MX
hi.. how can i send an array of text boxes to a sub??
im doing something like this:

Sub mySub (txt() as textBox)

end sub

and im calling like this:
mySub text1

(where text1 is an array with 3 elements:
text1(0)
text1(1)
text1(2)

i know its a stupid question but i cannt make it work.. can anybody help me please??

thank you very much
 
Hi:

Change the declaration to:

Sub mySub (txt as Variant)
txt(1).Text = "Somenting..."
txt(2).Text = "Somenting else..."
etc
End Sub

.............
Javier
 
You can receive a control array As Object. It is an object, not an array.

Private Sub (ctlAry As Object[/b[)
dim ctl as Textbox
For Eaxh ctl in ctlAry
.....
Next
End Sub Forms/Controls Resizing/Tabbing Control
Compare Code (Text)
Generate Sort Class in VB or VBScript
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top