Torna al Thread
Dim i As Integer
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim f As New Form2
f.MdiParent = Me
i += 1
f.Name = "f" & i
f.Show()
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim cc As ControlCollection = Me.Controls
Dim c() As Control = cc.Find(InputBox("Digitare il nome del form da chiudere (Il nome del form è scritto sul text del form stesso)"), True)
If c.Length = 0 Then Exit Sub
If c.Length > 1 Then MsgBox("Attenzione sono stati trovati " & c.Length & " form con lo stesso nome") : Exit Sub
Dim a As Form = c(0)
a.Close()
End Sub