April 2002
Intermediate to advanced
688 pages
19h 51m
English
Collection.Count Property
Microsoft.VisualBasic.Collection
objectvariable.Countobjectvariable (required; Collection Object)Object variable referring to a Collection object
Returns an Integer containing the number of members in the collection
Collections are 1-based; that is, the index of the first element of a collection is 1. In contrast, arrays are 0-based; the index of the first element of an array is 0.
For i = 1 To colMyCollection.Count
Set colSubCollection = colMyCollection.Item(CStr(i))
MsgBox colSubCollection.Item("Name")
Set colSubCollection = Nothing
Next iBecause collections are 1-based, you can iterate the members of a
collection by using index values ranging from 1 to the value of
objectvariable
.Count.
Read now
Unlock full access