I want to close a System.Windows.Forms.Form if the user clicks anywhere outside it. I\'ve tried using IMessageFilter, but even then none of the messages are passed to PreFi
SIMPLY WAY : on Form1 use this code to call form2:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Form2.Owner = Me
Form2.Show()
End Sub
and then use this code on form1 again :
Private Sub Form1_MouseClick(sender As Object, e As MouseEventArgs) Handles Me.MouseClick
If Form2.IsHandleCreated = True Then
Form2.Close()
End If
End Sub