Count

This is a property of each of the OLE collections that are part of VFP. In each case, it tells you how many objects are in that collection.

Usage

nCount = colCollection.Count
Chalk one up for polymorphism. VFP's native collections, like Forms and Controls, each have their own corresponding count property with a distinct name, such as FormCount and ControlCount. The WhateverCount property belongs to the same object that owns the collection. For example, forms have a Controls collection and a ControlCount property. But the developers got smarter. The new OLE collections, like Projects and Objects, own their own count and they all use the same name for it. Of course, we don't need the count for a collection as much as we used to because FOR EACH lets us loop through all the members without worrying about how many there are.

Example

* How many projects are open?
? Application.Projects.Count

See Also

Files, For Each, Objects, Projects, Servers


Back to Table of Contents

Copyright © 2002-2018 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. Click for license .