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

how to control the close button in control bar on the form

1.when the user click the close button on the top right of the form, I would
like to pop up a message box ask for answer, if user click no, then ignore
the action, otherwise exit the app.

2.trying to do something like, click on the close button, the app still run,
and only display the noticfyicon in tary bar.
thanks

Nov 15 '05 #1
4 1602
Hi Pei,

Override OnClosing method.

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com

"pei_world" <pe*******@hotmail.com> wrote in message
news:OO**************@TK2MSFTNGP12.phx.gbl...
1.when the user click the close button on the top right of the form, I would like to pop up a message box ask for answer, if user click no, then ignore
the action, otherwise exit the app.

2.trying to do something like, click on the close button, the app still run, and only display the noticfyicon in tary bar.
thanks

Nov 15 '05 #2
use the dialogResult associated with a MessageBox button.
pei_world wrote:
1.when the user click the close button on the top right of the form, I would
like to pop up a message box ask for answer, if user click no, then ignore
the action, otherwise exit the app.

2.trying to do something like, click on the close button, the app still run,
and only display the noticfyicon in tary bar.
thanks


Nov 15 '05 #3
thanks, but the problem is what can I use in Closing function
"Miha Markic" <miha at rthand com> wrote in message
news:ev**************@TK2MSFTNGP11.phx.gbl...
Hi Pei,

Override OnClosing method.

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com

"pei_world" <pe*******@hotmail.com> wrote in message
news:OO**************@TK2MSFTNGP12.phx.gbl...
1.when the user click the close button on the top right of the form, I

would
like to pop up a message box ask for answer, if user click no, then ignore the action, otherwise exit the app.

2.trying to do something like, click on the close button, the app still

run,
and only display the noticfyicon in tary bar.
thanks


Nov 15 '05 #4
Hi,

You will have to use the Closing event of the form, (not override it). In
the event handler do what you have to do and ask what you have to ask and if
you decide to abort the closing of the form just set the e.Cancel = True;
where e is the CancelEventArgs parameter in your event handler.

Hope that helps
Cata

"pei_world" <pe*******@hotmail.com> wrote in message
news:Oc**************@TK2MSFTNGP12.phx.gbl...
thanks, but the problem is what can I use in Closing function
"Miha Markic" <miha at rthand com> wrote in message
news:ev**************@TK2MSFTNGP11.phx.gbl...
Hi Pei,

Override OnClosing method.

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com

"pei_world" <pe*******@hotmail.com> wrote in message
news:OO**************@TK2MSFTNGP12.phx.gbl...
1.when the user click the close button on the top right of the form, I

would
like to pop up a message box ask for answer, if user click no, then ignore the action, otherwise exit the app.

2.trying to do something like, click on the close button, the app
still run,
and only display the noticfyicon in tary bar.
thanks



Nov 15 '05 #5

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

Similar topics

12
by: MLH | last post by:
I have created two forms: frmBrowseNegsMainform and frmBrowseNegsSubform. I put a subform control on the first of these. The SourceObject property for the subform control is, of course,...
2
by: Vern | last post by:
I'm trying to create a custom button control, and have the onclick event close the form. I was thinking I would use this.Parent,Close() but close() isn't in the drop down list. How can I do this?
1
by: Jorge Ponte | last post by:
hi I have a Web User Control (ascx) - lets call it "My_WUC" - in a Web form. In that WUC I want have a textbox and a button. I want to click on the button and open a popup (I use javascript for...
10
by: sqlboy2000 | last post by:
Hello all, I have something very simple going on here and I'm scratching my head as to what the problem is. There are 4 items in my project, 2 webforms, a user control, and a module: ...
7
by: Siv | last post by:
Hi, I have an MDI application that uses a generic "ShowPage" routine in a module that is called when I want to display a child form. The basic idea is that in the module I have declared each form...
7
by: Dennis | last post by:
How can I tell if a user clicks the Close "X" on the windows form control box? -- Dennis in Houston
9
by: Piccolo Pete | last post by:
This is a bit "wordy", but here is the scoop. I'm using Microsoft Visual Studio for VC++ in Windows 2000. I made an application which had no form in it. So when I ran the application, I just...
3
by: ApexData | last post by:
I'm starting a new project. A Personnel System. I have considered opening a single bound form to the main employee table. The user can scroll the records to any individual. I would like to have a...
9
by: timnels | last post by:
I have an issue where I have a user control that is launched into a floating form. At some point later, I allow the user to "unfloat" the user control by reparenting it on a split container in...
1
by: Swans, What Swans? | last post by:
I have a form with (among other controls) three text boxes that hold date fields from the underlying ControlSource. I have the OnDoubleClick event for each set to open up a Modal Popup form that...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.