• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 188
  • 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
 
GrahamSkanRetiredCommented:
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
 
GrahamSkanRetiredCommented:
TypeName(Text1) will retun "TextBox" for a single TextBox control and "Object" for an array
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
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
 
GrahamSkanRetiredCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

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