Count Property (InfoStores Collection)

Count Property (InfoStores Collection)

The Count property returns the number of InfoStore objects in the collection. Read-only.

Syntax

objInfoStoresColl.Count

Data Type

Long

Example

This code fragment maintains a global variable to loop through the small collection, and uses the Count property to keep it from getting too large:

' from InfoStores_NextItem
' iInfoStoresCollIndex is an integer used as an index
'   check for empty collection ...
'   check index upper bound
    If iInfoStoresCollIndex >= objInfoStoresColl.Count Then
        iInfoStoresCollIndex = objInfoStoresColl.Count
        MsgBox "Already at end of InfoStores collection"
        Exit Function
    End If
    ' index is < count; can be incremented by 1
    iInfoStoresCollIndex = iInfoStoresCollIndex + 1
    Set objInfoStore = objInfoStoresColl.Item(iInfoStoresCollIndex)
    If objInfoStore Is Nothing Then
        MsgBox "Error, cannot get this InfoStore object"
        Exit Function
    Else
        MsgBox "Selected InfoStore " & iInfoStoresCollIndex
    End If
 

See Also

Concepts

InfoStores Collection Object