473,320 Members | 2,161 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.

Can an MDI child close and MDI parent?

I've got a situation in a VB 2003 Windows application with an MDI form and a
child form. In certain situations, when the child is closed by the user, I
also want to close the MDI parent. Is there a way to close the MDI parent
with code in the child form?

In the MDI child form, I have tried:

me.MDIParent.Close

but that doesn't appear to work. Is that because of object references in
the parent that are still alive? Is this even possible?

Thanks!
Sep 18 '08 #1
3 2162
Form1.Close 'Form1 is the parent

"DaveP" <Da***@discussions.microsoft.comwrote in message
news:9F**********************************@microsof t.com...
I've got a situation in a VB 2003 Windows application with an MDI form and
a
child form. In certain situations, when the child is closed by the user,
I
also want to close the MDI parent. Is there a way to close the MDI parent
with code in the child form?

In the MDI child form, I have tried:

me.MDIParent.Close

but that doesn't appear to work. Is that because of object references in
the parent that are still alive? Is this even possible?

Thanks!
Sep 18 '08 #2
Gillard, Form1.Close looks like a static method call on class Form1. Is
that what you meant?

DaveP, It is possible to close the app from the child forms. I would raise
an event for the main app to handle the close operation.

"Gillard" <gillard_georges@@@@@@@@@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Form1.Close 'Form1 is the parent

"DaveP" <Da***@discussions.microsoft.comwrote in message
news:9F**********************************@microsof t.com...
>I've got a situation in a VB 2003 Windows application with an MDI form
and a
child form. In certain situations, when the child is closed by the user,
I
also want to close the MDI parent. Is there a way to close the MDI
parent
with code in the child form?

In the MDI child form, I have tried:

me.MDIParent.Close

but that doesn't appear to work. Is that because of object references in
the parent that are still alive? Is this even possible?

Thanks!
Sep 18 '08 #3
The idea of tryng to close the parent from the child never seemed qute
proper to me. The technique I have used is for the child to change a
property of the parent as it is closing, and then to put the code to clean
up the other children and close down the parent in the change event for that
parent property. At first it seemed like a kludge, but in practice it is
very effective. Of course, you should choose a property of the parent that
the user isn't going to change. For instance, change the text of the parent
to "Closing", and put the shutdown code in the parent's textchanged event.

"DaveP" <Da***@discussions.microsoft.comwrote in message
news:9F**********************************@microsof t.com...
I've got a situation in a VB 2003 Windows application with an MDI form and
a
child form. In certain situations, when the child is closed by the user,
I
also want to close the MDI parent. Is there a way to close the MDI parent
with code in the child form?

In the MDI child form, I have tried:

me.MDIParent.Close

but that doesn't appear to work. Is that because of object references in
the parent that are still alive? Is this even possible?

Thanks!
Sep 18 '08 #4

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

Similar topics

1
by: Joe D | last post by:
I think this is a simple question. But I am new to JS. Here is what I want to do: From a parent window, open a popup window (child) to get data from user, then user submit the request, close the...
3
by: Isabel | last post by:
How can you close all child browser windows that where open by a parent browser window? I have links on a parent (main) page that opens the child page as a separate browser. However, I need to be...
1
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at...
4
by: Sileesh | last post by:
Hi I have a btn in Parent.aspx page . On server_click() of the Btn, i am opening a new window called the child.apsx window. Child window also have a Btn. On serverClick of this Btn, I perform...
2
by: Paul | last post by:
Hi this is related to a previous post, hopefully just a bit clearer description o the problem. I have a parent form that opens a new form (child form) while still leaving the parent form open....
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...
7
by: Siv | last post by:
Hi, I have an MDI application that uses a generic "ShowPage" routine in a module that is called when I want to display a child form. The basic idea is that in the module I have declared each form...
0
by: bloombloom | last post by:
I am gonna post my AS in hopes that someone can get a good understanding of what i am doing. So here is the code: t1.onRelease = function() { infoField._visible = true; startLoading("cc11.swf");...
4
by: Buddha | last post by:
Hello, I posted this on two forums, without too much help .. and I am kinda stuck in this. I need to refresh the parent page from the second child window which is opened by the first child and...
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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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: 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
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.