471,347 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,347 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 2312
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by lauren quantrell | last post: by
reply views Thread by Lauren Quantrell | last post: by
1 post views Thread by Alpha | last post: by
5 posts views Thread by Stan Sainte-Rose | last post: by
3 posts views Thread by Karan | last post: by
reply views Thread by Ronak mishra | last post: by

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.