Solved

Passing A Textbox Control Array To A Function

Posted on 2004-10-17
3
191 Views
Last Modified: 2010-05-02
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
Comment
Question by:A_Tucker
3 Comments
 
LVL 20

Accepted Solution

by:
hes earned 100 total points
ID: 12333717
Change:
Private Function formatText(Txt() As TextBox)
To

Private Function formatText(TmpTxt As TextBox)
' No () in the control name
0
 

Author Comment

by:A_Tucker
ID: 12334430
easy when u know how! thanks!
0
 
LVL 76

Expert Comment

by:David Lee
ID: 12334445
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

Technology Partners: 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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question