|
-
Nov 29th, 1999, 11:08 AM
#1
Thread Starter
New Member
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
-
Nov 29th, 1999, 06:47 PM
#2
Hyperactive Member
How about this ?
for i=0 to mycollection.controls.count-1
mycollection.control(i).propertyname = propertyvalue
next i
-
Nov 29th, 1999, 09:18 PM
#3
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).]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|