473,761 Members | 8,651 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

[gui] closing or hiding a parent form

Dear all,

Is it possible to close or hide a parent form?

In particular, is it possible to do from the child form itself?

Thanks

Thorsten
Nov 17 '05 #1
4 2214
Hi,

Pass the parent form as part of the constructor of the child form, then as
needed call Hide()
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Thorsten Ottosen" <th***@wmdata.c om> wrote in message
news:42******** *************** @news.sunsite.d k...
Dear all,

Is it possible to close or hide a parent form?

In particular, is it possible to do from the child form itself?

Thanks

Thorsten

Nov 17 '05 #2

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us > wrote
in message news:OB******** ******@TK2MSFTN GP14.phx.gbl...
Hi,

Pass the parent form as part of the constructor of the child form, then
as needed call Hide()


For some reason this does not work as I expect.

-Thorsten
Nov 17 '05 #3
hi

post the code you are using

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Thorsten Ottosen" <th***@wmdata.c om> wrote in message
news:42******** *************** @news.sunsite.d k...

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us >
wrote in message news:OB******** ******@TK2MSFTN GP14.phx.gbl...
Hi,

Pass the parent form as part of the constructor of the child form, then
as needed call Hide()


For some reason this does not work as I expect.

-Thorsten

Nov 17 '05 #4

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us > wrote
in message news:eX******** ******@TK2MSFTN GP14.phx.gbl...
hi

post the code you are using


Can't do that; sorry.

But I can describe the situation a little better (something I should have
done the first time :-()

We start with the parent form:

using(frmMedarb ejderListe f = new frmMedarbejderL iste(
m_erMedarbejder sErindringer ) )
{
f.Open( this );
}

Then in the child form I do

public override void Open( Form parent )
{
frmMedarbejderS oeg fader = parent as frmMedarbejderS oeg;
fader.Hide(); // #2
Debug.Assert( fader.Visible == false );

base.Open( parent ); // #2
}

base.Open(paren t) does various stuff, but ends up calling this.ShowDialog ();

Now, the funny this is that if reorder the lines marked #1 and #2, the
parent form is not
hidden...when I look behind the child window, the parent form is still
there;

If I don't reorder the two lines, the parent form is hidden, but the screen
flickers
a bit before the child window appears proproly on the screen.

Neither behavior is particular good.

br

Thorsten
Nov 17 '05 #5

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

Similar topics

0
1116
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 to see who the sender is. If it is the appropriate child form the close is disabled and a message box shown. The problem is on the FormClosing event for the parent. It goes immediately to the first child form and displays the message box, then...
1
5821
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 MDI child window. My application does certain logic when the user actually closes the MDI child form by clicking the "X" in the upper right hand. My application, however, should not execute this logic if the user closes the MDI parent. I...
5
8210
by: Tarun Mangla | last post by:
Hi I am facing a problem. I've made an application in which two forms are there. One if Login form and another is main form. The problem is that, after getting authenticated from the database the main form is opened. But the login form is not getting closed. I am using the following code: It is in the load of the main form. this.ParentForm.Close();
6
3229
by: Gary Miller | last post by:
Does anyone know how to detect a modeless form on closing by the form that invoked the modeless form? form.Show();
17
4235
by: MumboJumbo | last post by:
Hi I have a really basic question hopefully some can help me with: Can you write a (i.e. one) C# project that works from the cmd line and gui? I seems if i write a GUI app it can't write to console using System.Console.WriteLine if thge project has its "Output Type" to "Windows Application". However I can write to stdio if i set output type to "Console Application". When I do this I unfortunately get a "console box" as well
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...
3
1356
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
6372
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 contains unsaved data. If the user clicks "No" then the code sets e.Cancel = True, which cancels the closure. This works just great. But when the user closes the MDI parent form, the cancellation seems to be completely ignored. The MessageBox...
12
1505
by: kronecker | last post by:
I found this nifty routine that closes a form one by one every time it is called. However, I need to hide them instead of closing them. Is there a way to alter the code? I assume it has something to do with this line here... PostMessage(i, CInt(&H10), vbNullString, vbNullString) Thanks
0
10115
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...
0
9957
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9775
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
8780
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...
1
7332
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5229
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
5373
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3881
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
3456
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.