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

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.
0
emi_sastra
Asked:
emi_sastra
  • 4
  • 3
1 Solution
 
GrahamSkanCommented:
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
0
 
emi_sastraAuthor Commented:
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.

0
 
GrahamSkanCommented:
TypeName(Text1) will retun "TextBox" for a single TextBox control and "Object" for an array
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
emi_sastraAuthor Commented:
Thank you.

I help.
0
 
emi_sastraAuthor Commented:
Sorry,

It show the same value= "textbox"

I try :

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

Thank you.
0
 
GrahamSkanCommented:
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"
0
 
emi_sastraAuthor Commented:
You are right.

Thank you.

0

Featured Post

Industry Leaders: 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!

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