Forms Collection for Visual Basic 6.0 Users
The Visual Basic 6.0 Forms collection is replaced by the My.Application.OpenForms Property property in Visual Basic 2008.
A Visual Basic 6.0 Forms collection is a collection whose elements represented each loaded form in an application. The collection includes the application's MDI form, MDI child forms, and non-MDI forms. The Forms collection has a single property, Count, which specifies the number of elements in the collection.
The Visual Basic 2008 OpenForms property returns a FormCollection object that contains all of the application's open forms. The behavior is the same as the Forms collection, and it can be used in the same ways.
The following examples illustrate differences in coding techniques between Visual Basic 6.0 and Visual Basic 2008.
Code Changes for Getting a Count of Open Forms
The following code demonstrates how to return the number of forms currently open in an application.
' Visual Basic 6.0 MsgBox Forms.Count