Solved

Passing A Textbox Control Array To A Function

Posted on 2004-10-17
3
190 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

809 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