I've been trying for almost 4 hours to get this working...and still no success. So I figured I would see if there was any help for the problem!
So here it is.
I've created this little test program. There very first time you run the program after it's created it actually works!
But if you stop it and then run it again, it throws an exception!
So when you click the button once to open the new form, it opens it. then close the form and click the button again and it throws an exception. But the very first time you run this program after it is created this actually works perfect.
Now here is the second catch. Run the program again. This time click the button 2 times, then close the form. Then click the button again, and it actually works.
So there it is.......thanks in advance for the help!
When you clise the Child form the instance of your public form variable is disposed, so this shouldn't work I guess. Don't ask me why it works the first time though..... Try something like this as an approach instead.....
Code:
Dim frm As Form
For Each frm In Me.MdiChildren
If TypeOf (frm) Is Form2 Then
frm.BringToFront()
Exit Sub
End If
Next
Dim myForm As New Form2()
myForm.MdiParent = Me
myForm.Show()