473,796 Members | 2,632 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Clo se();

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 2453
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.co m

"Maarten" <gu******@hotma il.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.Clo se();

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.c om> wrote in
message news:#9******** ******@TK2MSFTN GP11.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.co m

"Maarten" <gu******@hotma il.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.Clo se();

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.co m

"Maarten" <gu******@hotma il.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.c om> wrote
in
message news:#9******** ******@TK2MSFTN GP11.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.co m

"Maarten" <gu******@hotma il.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.Clo se();
>
> 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.c om> wrote in
message news:uw******** ******@TK2MSFTN GP11.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.co m

"Maarten" <gu******@hotma il.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.c om> wrote
in
message news:#9******** ******@TK2MSFTN GP11.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.co m

"Maarten" <gu******@hotma il.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.Clo se();
>
> 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
651
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 Excel.Worksheet Set ObjXL = CreateObject("Excel.Application") Set ObjXLBook = ObjXL.Workbooks.Open("Mypath\Myfile.xls", , True) Set ObjXLSheet = ObjXLBook.Worksheets("Main") ObjXL.Visible = True
1
10233
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 how do you HIDE the Access close button. Also, while I'm at it, what I really want to do is to hide the Access application's minimize, mazimize and close buttons. Thanks, lq
0
383
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? lq
1
5499
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 following code after the "Application.Run(new VMSMain());": static void Main() { Application.Run(new VMSMain()); }
5
11074
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
5
2725
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 In that event I check the: event handler ... if ( e.ClickedItem.Tag != null )
3
5947
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. This code works well for splash screen. I searched alot on net for codes but they don't work. for example- (1) Public Sub CloseForm(formType As System.Type) For Each oForm as System.Windows.Forms.Form in me.MdiParent.MdiChildren If...
5
5554
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 (from X from top right), the .exe process of my application is still in memory and visible in "Windows Task Manager" costing 60MB memory!!! The debugged application is only 32kb but it costs 60MB from memory which also does NOT kill itself...
0
9680
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
9528
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10173
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
10006
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
9052
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
7547
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
5441
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...
2
3731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2925
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.