Link to home
Start Free TrialLog in
Avatar of emi_sastra
emi_sastra

asked on

How to know the control is a control a control array or not?

Hi,

I want to know a control is a control a control array or not?

Thank you.
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

You won't get very far if you get it wrong because you get compile time errors
Text1 is indexed and text 2 isn't, so the first two lines compile OK. The last two lines give
'Compile error: Method or data member not found', and
'Compile error: Wrong number of arguments or invalid property assignment', respectively.

Debug.Print Me.Text1(1).Text
Debug.Print Me.Text2.Text
Debug.Print Me.Text1.Text
Debug.Print Me.Text2(1).Text
Avatar of emi_sastra
emi_sastra

ASKER

Hi,

I have to know it since it is a parameter for a function call.

In side the function I have to know it is a control array or not, so I know what to do.

Thank you.

ASKER CERTIFIED SOLUTION
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you.

I help.
Sorry,

It show the same value= "textbox"

I try :

Text1 = TypeName(Text1)
Text2(0) = TypeName(Text2(0))

Thank you.
I'm not sure if you still have trouble. This is what happens on my system.

Debug.Print TypeName(Text1) 'This is an array and returns "Object"
Debug.Print TypeName(Text2) 'This is a single instance and returns "Textbox"
You are right.

Thank you.