• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 196
  • Last Modified:

Passing A Textbox Control Array To A Function

I have a textbox control array.

I'd like to pass it to my function. There, it would create another instance of that textbox and do some work on it.
I have tried the following code, but get the error: "Type mismatch: array or user-defined type expected"

Call formatText(Text1(0))

Private Function formatText(Txt() As TextBox)
'do some work on the Txt() control
End Function

Any Suggestions? Many Thanks.
A. Tucker
0
A_Tucker
Asked:
A_Tucker
1 Solution
 
hesCommented:
Change:
Private Function formatText(Txt() As TextBox)
To

Private Function formatText(TmpTxt As TextBox)
' No () in the control name
0
 
A_TuckerAuthor Commented:
easy when u know how! thanks!
0
 
David LeeCommented:
The code hes posted will only work if you want to pass one member of the Text1 control array.  If you want to pass the entire array, then the array need to be passed as an object or a variant.  Something like:

Private Function formatText(Txt as Object)

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now