Count Property (Visual FoxPro)

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.

Object.Count

Return Value

Numeric

Remarks

Applies To: Files Collection (Visual FoxPro) | Projects Collection (Visual FoxPro) | Servers Collection | Collection Class

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

Concepts

Access and Assign Methods

Reference

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

Other Resources

Properties (Visual FoxPro)

Language Reference (Visual FoxPro)