PC Review


Reply
Thread Tools Rate Thread

Closing MDI Child form problem??

 
 
al
Guest
Posts: n/a
 
      16th Dec 2003
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

MTIA,
Grawsha
 
Reply With Quote
 
 
 
 
Armin Zingler
Guest
Posts: n/a
 
      16th Dec 2003
"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

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
closing an MDI child form Jake Wiley Microsoft C# .NET 0 16th Dec 2005 04:35 PM
Closing event in a MID Child form I don't know if the child form is closing or the main form is closing **Developer** Microsoft C# .NET 1 19th Oct 2005 04:51 PM
Closing a MDI child form =?Utf-8?B?Q2hyaXM=?= Microsoft C# .NET 2 19th Oct 2004 10:25 PM
Closing MDI Child Form =?Utf-8?B?Q2hhcmxpZQ==?= Microsoft VB .NET 1 7th Jul 2004 04:53 AM
child form closing when it should not Bamse Microsoft Dot NET Framework Forms 10 25th May 2004 02:12 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:46 AM.