473,725 Members | 2,243 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

close child form when parent form is closed.

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 form?
navigate to form 2, child form still
open-want to close automatically.
*************** *** *************** **
form 1-btn 2 goto form2* * form 2 was form 1 *
btn1- open child form * *************** **
*************** *** browser window1
browser window 1

***************
* child form *
* btn-close this frm*
**************
browser window 2
Paul G
Software engineer.
Nov 18 '05 #1
2 2905
You'll probably need to save the handle described in previous post to a
hidden text control then save it to session during postback.

Then you can build a common routine that'll use the saved session variable
to generate the closeall() javascript/vbscript you needed.

"Paul" <Pa**@discussio ns.microsoft.co m> ¦b¶l¥ó
news:A1******** *************** ***********@mic rosoft.com ¤¤¼¶¼g...
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 form?
navigate to form 2, child form still
open-want to close automatically.
*************** *** *************** **
form 1-btn 2 goto form2* * form 2 was form 1 *
btn1- open child form * *************** **
*************** *** browser window1
browser window 1

***************
* child form *
* btn-close this frm*
**************
browser window 2
Paul G
Software engineer.

Nov 18 '05 #2
Here is another approach:

Do not use Response.Redire ct() and use a web page with frameset to wrap it,
then save the handle to hidden variables on the outer page. In this fashion,
you can also specify onunload event that will close all child windows
whenever the main window closes. Very cool!

"Paul" <Pa**@discussio ns.microsoft.co m> ¦b¶l¥ó
news:A1******** *************** ***********@mic rosoft.com ¤¤¼¶¼g...
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 form?
navigate to form 2, child form still
open-want to close automatically.
*************** *** *************** **
form 1-btn 2 goto form2* * form 2 was form 1 *
btn1- open child form * *************** **
*************** *** browser window1
browser window 1

***************
* child form *
* btn-close this frm*
**************
browser window 2
Paul G
Software engineer.

Nov 18 '05 #3

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

Similar topics

4
5666
by: Colin Graham | last post by:
Hi guys, Just a quickie here that i hope someone can help me with. Basically i want stop the user from closing the popup window using the small x button in the top right hand corner. Im aware that i cant disable this so i thought is it possible to do a check to see if a hidden text on the main form has a value. E.g. if we close the popup correctly then text box on the main form will say true. If we close the text box using the x in the...
7
2516
by: Alice | last post by:
Hi, In my program, the user can navigate to many different forms. When they go to the next form, I want the form they have left to close. However, the forms aren't closing. Can anyone tell me what I'm doing wrong? Here is a sample snippet of code where the user can return to the main form while simultaneously closing the previous form.
5
11069
by: Stan Sainte-Rose | last post by:
Hi, Which event is called when the user click on the close window icon (X) ? I want, when he clicks on this icon, to display a message before closing the form. If he replys by No, I don't want to close the form. Thks for your help Stan
6
6651
by: Tom | last post by:
Is there ANY easy way to close a MDI Child form in the middle of it's load? For instance, during the Load event I find a need to close the form (for whatever reason - maybe the user isn't ready for it yet, or it displays another form and they hit cancel). In any event, I need to be able to cause that MDI Child form to close. Just sticking Me.Close in there won't work, generates an error (note however, that on a NON-MDI form this seems to...
0
1720
by: Tom | last post by:
Let's say I have an MDI parent that has 5 open child windows in it. Now let's say that I have a function in the MDI parent that attempts to close all the child windows. It's starts running, closing the child windows; however, let's say that the second window it attempts to close has a Closing event and in that event (for whatever reason) the e.Cancel gets set to true (maybe the user is in the middle of something and doesn't want that window...
4
2771
by: LCAdeveloper | last post by:
Help! Another newbie question I'm afraid. I have a toolbar on an MDI form, which I can control OK to produce a child form. When the child form is active, the appropriate MDI parent form toolbar button properties are set as follows: .pushed=true and .enabled=false. My problem is how do I set the reverse conditions when I close this child form? I have tried putting (in the Exit button click event) Toolbar1.Buttons(6).Pushed=False...
1
2322
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 see if there are any outstanding database changes that have not been saved. If there are I give the user the option of abandoning the closing of the form by issuing a "e.cancel" statement. This works perfectly if the user hits the X in the...
12
6233
by: Phil | last post by:
I can check for MdiChildren.Length=0, but which event handler should I put this in to detect when a child window is closed? TIA Phil.
3
2186
by: =?Utf-8?B?RGF2ZVA=?= | last post by:
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
0
8889
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
9401
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
9179
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
9116
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8099
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
6011
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
4519
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
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2637
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.