On Dec 4, 7:01 pm, Terry <Ter...@nospam.nospamwrote:
I guess it depends on what kind of 'state' the Form2 can be in. What you
have here won't work if the form was hidden or minimized. Have a minimize
button on Form2? Have any other button that causes a Me.Hide?
Good point. I replaced the BringToFront method with a Dispose and New
Form and it seems to work. Thanks!
Public Class Form1
Dim objForm As Form2
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
If (IsNothing(objForm)) Then
objForm = New Form2
objForm.Show()
Else
If (objForm.Created) Then
objForm.Dispose 'changed from BringToFront
objForm = New Form2
objForm.Show()
Else
objForm = New Form2
objForm.Show()
End If
End If
End Sub
End Class