-
Hi!
I have a collection of controls that i build in the form load.
How do i access each control in it.
The code is like this...
For Each mycontrol in controls
if typeof mycontrol is textbox then
mycollection.add mycontrol
next
Now in mycollection i want to access a control.
Thanks in advance...
satheesg
-
How about this ?
for i=0 to mycollection.controls.count-1
mycollection.control(i).propertyname = propertyvalue
next i
-
msdnexpert may be thinking of something else, but a collection has only 4 properties: Add, Count, Item, and Remove. To access a control you use the Item property and do something like this
Code:
For i = 1 To mycollection.Count
mycollection.Item(i).BackColor = 1234
Next i
Note that while most VB things are 0-based a collection is 1-based.
------------------
Marty
[This message has been edited by MartinLiss (edited 11-30-1999).]