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

What is a collection?

Status
Not open for further replies.

yumbelie

Programmer
Dec 31, 2002
96
GB
Could someone explain what exactly a collection object is in the context of OO VB? I understand what classes do, but I don't quite understand what collections are. Could someone enlighten me?

Thanks.

 
From MSDN:

"A Collection object is an ordered set of items that can be referred to as a unit. The Collection object provides a convenient way to refer to a related group of items as a single object. The items, or members, in a collection need only be related by the fact that they exist in the collection. Members of a collection don't have to share the same data type."

A common example is a form's Controls collection. It can contain textboxes, labels, frames, images, etc.. All are different, and may operate separatly, but are related because they are a control, or object, on the form and therefore in the collection.

You can also create your own collection in order to refer to any group of objects at once or conveniently (via a loop).

Code:
Dim myColl as New Collection

zemp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top