473,322 Members | 1,421 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Closing MDI Child form problem??

al
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
Nov 20 '05 #1
1 1401
"al" <gr*********@yahoo.com> 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

Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Ron L | last post by:
I have an MDI application with a number of child windows. In each child window I am catching the Closing event and having the child window decide if it should set cancel to true. The intent here...
2
by: Ron L | last post by:
I have an MDI application which opens a number of child windows, each of which could have data in a state that needs to be saved. Each child window catches its Closing event and cancels it if the...
1
by: Chris Bruce | last post by:
In my application I need a way to distiguish between the following events: 1. When a user closes an MDI child window. 2. When the user closes the MDI parent window which subsequently closes the...
1
by: **Developer** | last post by:
When I get a closing event in a MID Child form I don't know if the child form is closing or the main form is closing. Is there a way to tell? Thank
5
by: John | last post by:
Hi I have a main form that contains a panel which contains a child form. The problem is that when the main form is closed by the user, the 'closing' event for the child form is not triggered,...
10
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the...
3
by: Charles Law | last post by:
Under what circumstances would e.Cancel be set to True on entry to the Closing event of an MDI child form? I have found that this is why my application won't close properly. I can explicitly set...
3
by: Sumit | last post by:
HI.. I am having problem ot determine that a parent form is closing or not in my VB.Net code Any help Sumit
3
by: Oenone | last post by:
I'm writing an application with various MDI child forms. In the Closing event of many of the forms, I have code that asks the user whether he is sure he wants to close the form, because it...
19
by: zacks | last post by:
I have a .NET 2.0 MDI application where the child form has a Tab Control. Each of the Tab in the Tab Control has a Validating event to handle what it should do when the user changes tabs. But...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.