Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting a Collections object

Status
Not open for further replies.

jender624

Programmer
Jul 1, 2003
50
US
I'm trying to set a collections object to a group of controls, for example:

Dim colControls = New Collection

Set colControls = Me.Controls

I'm having trouble doing this; I'm getting a type mismatch error. Does anybody have an idea why?

Thanks,

jender624
 
Oops, sorry I meant:

Dim colControls as New Collection

Set colControls = Me.Controls
 
Something like this ?
Dim colControls as New Collection, myCtrl As Object
For Each myCtrl In Me.Controls
colControls.Add Item:=myCtrl, Key:=myCtrl.Name
Next

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top