Solved

Collections question.

Posted on 2000-04-05
2
197 Views
Last Modified: 2010-05-02
Is it possible to add different types of controls to a single collection? For example i would like to add an array of textboxes, check boxes, and option boxes to the same collection so I can loop through the collection and set properties of each control. Also is it possible to tell what type of control it is as you are looping throught the collection? Please provide code. Thanks
0
Comment
Question by:Jaysor
2 Comments
 
LVL 1

Accepted Solution

by:
phiro earned 50 total points
ID: 2687465
Something like this :

**********START CODE

dim o as Label
dim c as new Collection
dim iTeller as integer
dim Enumerator as Object

for iTeller=0 to 100
  Set o = new Label
  c.Add o , Cstr(iTeller)
next iTeller

dim o2 as ComboBox

for iTeller=101 to 200
  Set o = new ComboBox
  c.Add o , Cstr(iTeller)
next iTeller

for each Enumerator in c
  if Enumerator is TypeOf Label
    'Do stuff with your label
  endif

  if Enumerator is TypeOf ComboBox
     'Do stuff with you ComboBox
  endif
next

************END CODE

0
 

Author Comment

by:Jaysor
ID: 2687606
Your syntax is wrong for the If statements it should read

if TypeOf Enumerator is Label then
end if


but you helped me out so thanks..
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

Suggested Solutions

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

735 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