PDA

Click to See Complete Forum and Search --> : Creating a collection


David Laplante
Nov 10th, 1999, 04:00 AM
Hi. I have a small problem about creating a collection.

I sure know how to loop through all controls of a collection (for each ctl in form.controls). The problem is I would like to CREATE such a collection myself. (Ex.: I will add to a collection all the textboxes that the user have modified).

Afterward, I would to refer to this control. I'm not how could this be done.

Thanks for the help.

Ghost
Nov 10th, 1999, 04:16 AM
'Declare a collection
Dim something as New Collection

'Add the modified textbox in the collection

something.Add txtMyName

'Loop through the collection using For Each..Next

David Laplante
Nov 10th, 1999, 10:48 AM
I already tried this. This code will add the VALUE of txtMyName to the collection.
Looping with For Each...Next through the collection won't allow me to refer to this control. Am I right?

I would like to loop through that collection and change the .value of these controls to something I will decide. Or let's just say I want to loop and set the collection's controls to .visible = false. How could I make such a reference?

Thanks!

David Laplante
Nov 10th, 1999, 07:09 PM
...I tried to dim some variables AS CONTROL. And I thought I could do something like ctlMyControl.name = "txtControlName" but that property doesn't exist for such a new dimmed variable.

Still in need of any comments. Thanks.