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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing arrays to Collections

Status
Not open for further replies.

dartronix4

Programmer
Mar 15, 2002
3
US
Does anyone have a basic description of how to change a program using arrays into a program using collections? Is there a simple way to explain this? I am in second year VB6 in college and I am having some problems with this concept. Thanks
 
arrays of what into collections. If your talking about collections of objects, i.e. If you have 10 text boxes in an array, and want a collection of them instead then.

Dim objCol as Collection
Dim objControl as Control

For each objControl in Form1.Controls
If objControl = TextBox then
objCol.Add objControl
End If
Next Craig, mailto:sander@cogeco.ca

Remember not to name the Lambs...
It only makes the chops harder to swallow
 

If you want to do this for an array then try the following:

Dim colCloneArray as collection
Dim vItem as variant

For each vItem in myArray
colCloneArray.Add vItem
Next vItem
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top