473,320 Members | 2,158 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,320 software developers and data experts.

Closing a parent form from a child form

Hi
I have 3 forms, form1, form2 and form3. The form1 is the parent form and the other two are its child forms. However my question is that how can I close the main form1 when I close the other two forms. I tried couple of different methods but it gives me the error, "cannot access disposed object". Can anyone please help???
Aug 28 '08 #1
3 1088
balabaster
797 Expert 512MB
I have to say, I'm not exactly following what you're trying to do...

Form1 is the main parent, and Form2 and Form3 are children of Form1... am I with you so far?

Now, when you close Form2 and Form3, whichever form you close last needs to close Form1 with it?
Aug 28 '08 #3
joedeene
583 512MB
ohhh, i think i misunderstood the question, should application.exit() work? i thought you just wanted to close the main form without closing the other forms. but application.exit() i believe informs each window to close. you can also do an unsecure way by finding the process, and using process.kill() but i would not suggest that. but try application.exit() first and in the form_closing event for each form to close any opened threads(if any) by the form...

joedeene
Aug 29 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Kathy D | last post by:
I have created an mdi parent form with four children. I want to disable closing the four children but allow closing the parent form. I created a FormClosing event on each form. That event tests...
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...
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...
6
by: Barry Gast | last post by:
Hi. I have an MDI Parent form with multiple child windows. When I close the parent form, the Closing events of the children forms are not executing. Do I have to close all the child forms in the...
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...
1
by: JohnR | last post by:
I have a form that is presented in an mdi child window. If the user hits exit or the X button on the titlebar of the mdi child form, that form's "closing" event fires and in that event I check to...
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:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
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
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: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
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...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
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: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.