473,562 Members | 2,901 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 2897
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> 在郵件
news:A1******** *************** ***********@mic rosoft.com 中撰寫...
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> 在郵件
news:A1******** *************** ***********@mic rosoft.com 中撰寫...
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
5657
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...
7
2510
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
11057
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
6641
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...
0
1714
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...
4
2761
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...
1
2316
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...
12
6216
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
2172
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...
0
7577
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7869
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. ...
1
7627
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...
0
6221
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 projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5477
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3608
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2073
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
1
1191
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
903
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...

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.