//flex table opened by JP

Click to See Complete Forum and Search --> : VB Control Arrays and Nested Procedures


Spider
12-14-2002, 07:03 PM
I have a cmbButton_click event which calls three user defined subs. The final sub references a contol array consisting of several text boxes. How do I pass a contol array index to the nested procedure?

Example:

Private Sub cmbButton_Click()
.
.
.
Call FirstUserDefinedSub()
.
.
.
Call SecondUserDefinedSub()
.
.
.
And the last user defined sub...

Private Sub UserDefined
txtTextBox(index).Text = ""
txtTextBox(index).Text = ""
txtTextBox(index).Text = ""
End Sub

The above does not work, but shows what I would like to be able to do. I need to get the Index (subscript) value to the last nested sub procedure.

AltatemTC
12-16-2002, 12:41 PM
Your calling procedure should be as follows:

UserDefined Text1

Don't use parens(), just pass the name of the control array. I have only tested this on textbox controls so I won't gaurantee it will work for anything else.


Your user defined function should be as follows:

Public Sub UserDefined(TextboxControlArray As Variant)
Dim intI As Integer
For intI = 0 To TextboxControlArray.UBound
MsgBox TextBoxControlArray(intI).Text
Next intI
End Sub

I hope this helps.

AltatemTC
12-16-2002, 12:42 PM
Sorry not a function, it's a procedure.