473,386 Members | 1,720 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,386 software developers and data experts.

close hide

Hi

I'm trying to make something i tought is was simple

if i press the cross on the childform to close it, i want it to hide.
but when i press a button on the parrent i want to close the child.

so on the child i made a formclosing handler an in the handler i put:
this.hide();

now on the parrentform i do:
parrentform.Close();

but... ofcourse when i do this the closing eventhandler on the form is
called and the form hides itselfe.

what can i do?



Dec 8 '05 #1
4 2418
Maarten,

Expose a flag on the child form which indicates whether or not the
parent form is closing it. Before the parent form closes the child form,
set the flag to true.

Then, in your form closing event handler, check the flag. If the flag
is true, then do not hide the form and cancel the event, rather, just let it
close.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Maarten" <gu******@hotmail.com> wrote in message
news:43***********************@news.skynet.be...
Hi

I'm trying to make something i tought is was simple

if i press the cross on the childform to close it, i want it to hide.
but when i press a button on the parrent i want to close the child.

so on the child i made a formclosing handler an in the handler i put:
this.hide();

now on the parrentform i do:
parrentform.Close();

but... ofcourse when i do this the closing eventhandler on the form is
called and the form hides itselfe.

what can i do?


Dec 8 '05 #2
how can i indicate wether the form itselve or the Parrent is closing it?
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:#9**************@TK2MSFTNGP11.phx.gbl...
Maarten,

Expose a flag on the child form which indicates whether or not the
parent form is closing it. Before the parent form closes the child form,
set the flag to true.

Then, in your form closing event handler, check the flag. If the flag
is true, then do not hide the form and cancel the event, rather, just let it close.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Maarten" <gu******@hotmail.com> wrote in message
news:43***********************@news.skynet.be...
Hi

I'm trying to make something i tought is was simple

if i press the cross on the childform to close it, i want it to hide.
but when i press a button on the parrent i want to close the child.

so on the child i made a formclosing handler an in the handler i put:
this.hide();

now on the parrentform i do:
parrentform.Close();

but... ofcourse when i do this the closing eventhandler on the form is
called and the form hides itselfe.

what can i do?



Dec 8 '05 #3
Maarten,

Expose a property that the parent form will call which will set a flag
on the child form. Either that, or expose another Close method which the
parent form will call which will set the flag in the child form internally.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Maarten" <gu******@hotmail.com> wrote in message
news:43***********************@news.skynet.be...
how can i indicate wether the form itselve or the Parrent is closing it?
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote
in
message news:#9**************@TK2MSFTNGP11.phx.gbl...
Maarten,

Expose a flag on the child form which indicates whether or not the
parent form is closing it. Before the parent form closes the child form,
set the flag to true.

Then, in your form closing event handler, check the flag. If the
flag
is true, then do not hide the form and cancel the event, rather, just let

it
close.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Maarten" <gu******@hotmail.com> wrote in message
news:43***********************@news.skynet.be...
> Hi
>
> I'm trying to make something i tought is was simple
>
> if i press the cross on the childform to close it, i want it to hide.
> but when i press a button on the parrent i want to close the child.
>
> so on the child i made a formclosing handler an in the handler i put:
> this.hide();
>
> now on the parrentform i do:
> parrentform.Close();
>
> but... ofcourse when i do this the closing eventhandler on the form is
> called and the form hides itselfe.
>
> what can i do?
>
>
>
>
>
>
>



Dec 8 '05 #4
indeed
thanks this was actualy not that hard.

regards maarten.
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:uw**************@TK2MSFTNGP11.phx.gbl...
Maarten,

Expose a property that the parent form will call which will set a flag
on the child form. Either that, or expose another Close method which the
parent form will call which will set the flag in the child form internally.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Maarten" <gu******@hotmail.com> wrote in message
news:43***********************@news.skynet.be...
how can i indicate wether the form itselve or the Parrent is closing it?
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote
in
message news:#9**************@TK2MSFTNGP11.phx.gbl...
Maarten,

Expose a flag on the child form which indicates whether or not the
parent form is closing it. Before the parent form closes the child form, set the flag to true.

Then, in your form closing event handler, check the flag. If the
flag
is true, then do not hide the form and cancel the event, rather, just let
it
close.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Maarten" <gu******@hotmail.com> wrote in message
news:43***********************@news.skynet.be...
> Hi
>
> I'm trying to make something i tought is was simple
>
> if i press the cross on the childform to close it, i want it to hide.
> but when i press a button on the parrent i want to close the child.
>
> so on the child i made a formclosing handler an in the handler i put:
> this.hide();
>
> now on the parrentform i do:
> parrentform.Close();
>
> but... ofcourse when i do this the closing eventhandler on the form

is > called and the form hides itselfe.
>
> what can i do?
>
>
>
>
>
>
>



Dec 8 '05 #5

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

Similar topics

2
by: Ronny Sigo | last post by:
Hello all, I have to open a readonly Excel sheet from clicking on a button on an access form. So far no problem: Dim ObjXL As Excel.Application Dim ObjXLBook As Excel.Workbook Dim ObjXLSheet As...
1
by: lauren quantrell | last post by:
Before getting pistol whipped, I know this is a well-worn topic but I don't see the answer... I know how to hide the Access window, I know how to disable the Access application's close button, but...
0
by: Lauren Quantrell | last post by:
I use the code below to hide the MS Access Close button and the minimize and maximize buttons. What I want to do is to hide the close button but not the min/max buttons. Is this possible? ...
1
by: Alpha | last post by:
I have a Window based application that shows up still running in the task manager when I close it. It reaches the "this.close" statement and then it stops at the "}" at the section of the...
5
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...
5
by: Eric Renken | last post by:
OK, I have a form with a menu and a tool bar. In the Menu I have a File menu that contains a "Exit" item. When I click this Exit item. I have an event wired to: mnuFile.DropDown.ItemClicked ...
3
by: Karan | last post by:
I am calling finalize when form2 loads and deactivates form1 which closes form1. However, same thing is not happening in form2 because finalize is already called. Does anybody has solution to it....
5
by: kimiraikkonen | last post by:
I made a very small (2 forms) application with VB.NET 2005 express and second form contains web-browser component and flash movie inside it. Everything OK but after i close the program via normal...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...

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.