Forms Collection

See Also561DHU              Properties1HNSG8K               Example1GHI0NU>Low

Description

A collection17X8LRK whose elements represent each loaded form in an application.  The collection includes the application's MDI17QZO3L form, MDI childEXWLAX forms, and non-MDI forms5272EF.  The Forms collection has a single property, CountVN7VUP, that specifies the number of elements in the collection.

Usage

Forms(index)[.control][.property][ = setting ]

Remarks

In the preceding syntax, the range of index is 0 to Forms.Count-1.  The Forms collection is useful for iterating through all loaded forms in an application.  Note that Forms is a keyword, but not a reserved word.  It identifies an intrinsic global variable named Forms.  You can use Forms(index) as an argument to a function with a parameter of type Form.


Properties

CountVN7VUP


See Also

Help:

Controls CollectionB2IKWH

Dim StatementLANDIM

 

Programmer's Guide:

Chapter 8, "Objects and Instances"


Forms Collection Example

The OBJECTS.MAK file referred to in Chapter 8 of the Programmer's Guide includes the following procedure to fill a list box with the captions of all the currently loaded forms:

Sub Form_Activate ()

   Dim I                                 ' Declare variable.

   ' Refill list (in case an instance was added or removed).

   lstForms.Clear                        ' Clear list box.

   For I = 0 To Forms.Count - 1

      lstForms.AddItem Forms(I).Caption

   Next I

End Sub