Collections are grouping of related item togrther. Its hetrogenous in nature meaning the members of collection need not share the same data types, its very handy as we doesn’t always need collection of same type.
Collection is created like any other object:
Dim garbagesalesitems as collection
Members can be added or removed by using add or remove methods. We can also reach specific members in the collection using item method.
Most importantly from programming point of view we can loop in a collection using For each … next statement. Collections are useful and one of the high points of basic but its not very tight and uniform coding practice.
Zero-Based and One-Based Collections
A collection can be zero-based or one-based, depending on what its starting index is. The former means that the index of the first item in the collection is 0, and the latter means that it is 1. An example of a zero-based collection is the .NET Framework Controls collection. The Visual Basic Collection object is an example of a one-based collection.
One-based collections can be more intuitive to Visual Basic users, because the index ranges from 1 through the value of the Count Property (Collection Object), which returns the number of items in a collection. The index of a zero-based collection, by contrast, ranges from 0 through one less than the value of the Count property. This can be appropriate when the index values are offsets from a base value or correspond to members of a zero-based enumeration.
.NET Framework collections are zero-based for the purpose of standardization. The Visual Basic Collection class is one-based for the purpose of compatibility with previous versions.