Visual Basic Reference

Forms Collection Example

This example fills a list box with the captions of all the currently loaded forms.

Private 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
Show: