473,756 Members | 6,661 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Cl ose

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 2188
Form1.Close 'Form1 is the parent

"DaveP" <Da***@discussi ons.microsoft.c omwrote in message
news:9F******** *************** ***********@mic rosoft.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.Cl ose

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_george s@@@@@@@@@hotma il.comwrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
Form1.Close 'Form1 is the parent

"DaveP" <Da***@discussi ons.microsoft.c omwrote in message
news:9F******** *************** ***********@mic rosoft.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.Cl ose

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***@discussi ons.microsoft.c omwrote in message
news:9F******** *************** ***********@mic rosoft.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.Cl ose

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
4534
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 child window, an ASP page is generated from server and displayed with data in parent window, rather than child window. Right now, I can display in child window. But do not know how to display in parent. TIA
3
3754
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 able to close all the opened child browser pages from the parent page. Thank you for your help, Isabel
1
11581
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 http://weblogs.asp.net/asmith/archive/2003/09/15/27684.aspx but it was far more complex then I needed. (I got lost trying to figure it all out). Therefore, here goes my simple "web dialog box with parent event handler fireing" solution. ...
4
4257
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 some operation . Once the operation is done, i have to close the child window, and refresh the parent window automatically. I am able to close the child window automatically , But not able to refresh the parent window.
2
2907
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. Although the child form has a close button (with java script) if the user navigates the parent form to another form the child form is still open. Just wondering if there is a way to close the child form when the user navigates away with the parent...
10
4029
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 application. What should happen, is that the main MDI form should close, taking the child forms with it. There is code to loop through the child forms, remove the controls on each of them, and then close the form, but this code should execute only...
7
3113
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 as follows: Friend F0 As frmMain Friend F1 As frmStart Friend F2 As frmSearch Then in my ShowPage routine (which is passed a string "pageToShow" which is the name of the form I wish to open), I first check to see if we already have an instance...
0
2648
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"); }; t2.onRelease = function() { infoField._visible = true; startLoading("cc11.swf"); };
4
3983
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 the first child window closes after opening the second child. This is the second time I am typing the post, I lost all content because the site complaine I was using the lesser than symbol.
0
9456
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10040
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9846
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8713
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6534
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5142
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3806
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2666
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.