"al" <(E-Mail Removed)> schrieb
> Greegins,
>
> I have child form included in an MDI form. Things work fine until
> I Close the child form. The prolem is when I try to open that
> same child form form menu, app crashes saying it can't create dispoed
> form.
> I declare and instansiate the child form in the declartion section
> of
> MDI parent and have .show method of the child form to display it.
> How can I avoid the carsh problem??
>
>
> Dim frmempInstance As New Emp 'this is the instansiation of the
> child form
>
> Private Sub Emp_Click(ByVal sender As System.Object, ByVal e As _
> System.EventArgs) Handles Emp.Click
>
> frmempInstance.Show() 'here the app carshes after second opening
> the child form.
>
> End Sub
If you are the same "al" as in the other thread, you have already gotten the
answer that you can handle the Closed event of the child form. In the event
handler for the closed event, set frmempInstance to Nothing. The next time
you want to show the child form, check if the variable is nothing. If it is,
create a new instance and show it. If it is not, you can activate the
already visible child form by calling it's Activate method.
--
Armin
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html