Remove Forms Dynamically

Sohaib_A

New member
Joined
Jan 7, 2009
Messages
1
Programming Experience
Beginner
I have two forms Form1 and Form2.

Form1 is embedded as control in Form2.

Multiple instances of Form1,each with a different name are open in Form2.

I want to close all open instances of Form1 at the same time with the click of a button.

How should i start?
 
VB.NET:
For i As Integer = Application.OpenForms.Count - 1 To 0 Step -1
    Dim f As Form = Application.OpenForms(i)
    If TypeOf f Is Form1 Then
        f.Close()
    End If
Next
 
Back
Top