close forms

SIMIN

Regular
Joined
Mar 10, 2008
Messages
92
Hi everyone,
Does anyone know how can I close all forms on my application EXCEPT main / startup form?
Something like this in VB6 ?
Visual Basic:
Dim frm As Form
For Each frm In Forms
 Unload frm
 Set frm = Nothing
Next
 
Could you not have a collection of forms and simply add each form you open to it? To close them all you would simply loop over the collection and call the .Close method of each form in turn.
 
Back
Top