Collection.Count Property


Collection.Count Property

Class

Microsoft.VisualBasic.Collection

Syntax

     Dim result As Integer = objectVariable.Count 


objectVariable (required; Collection)

The instance of a Collection for which items are to be counted

Description

The Count property returns the number of items currently contained in a collection.

Usage at a Glance

Collections are 1-based; this differs from arrays, which are 0-based. Collection items range from 1 to the value returned by the Count property.

Example

     For counter = 1 To someCollection.Count        oneItem = someCollection.Item(counter)        ...more code here...     Next counter 

Version Differences

Visual Basic 2005 adds support for generics to several collection-style classes. Generics are discussed in Chapter 10.

See Also

Collection Class, Collection.Add Method, Collection.Item Property, Collection.Remove Method




Visual Basic 2005(c) In a Nutshell
Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))
ISBN: 059610152X
EAN: 2147483647
Year: 2004
Pages: 712

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net