Count Property

Visual Studio .NET 2003

Contains the number of items in a collection, for example, project , file, or server objects in a project, file, or server collection. Read-only at design time and run time.


Property Values



For a projects collection, the Count property contains zero if no instances of the Project Manager exist. For a file or server collection, the Count property contains zero if no files or servers exist in the file or server collection.

You can use the Count property to access the number of items in a collection. However, you cannot manually change Count except by using the Add and Remove methods of the collection. Collection objects provide their own Add and Remove methods.

You should use Count to determine the number of items in a collection when iterating through items in the collection using FOR…ENDFOR or referencing individual items with the Item method.

Count supports the Access method. Since Count is read-only, it does not support the Assign method.

See Also

Item Method (File Object) | Add Method (File Object) | Remove Method (File Object) | Item Method (Collection Class) | Add Method (Collection Class) | Remove Method (Collection Class) | FOR … ENDFOR Command | Access and Assign Methods

Applies To: Files Collection | Projects Collection | Servers Collection | Collection Class