473,800 Members | 2,413 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1625
Hi Pei,

Override OnClosing method.

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

"pei_world" <pe*******@hotm ail.com> wrote in message
news:OO******** ******@TK2MSFTN GP12.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******** ******@TK2MSFTN GP11.phx.gbl...
Hi Pei,

Override OnClosing method.

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

"pei_world" <pe*******@hotm ail.com> wrote in message
news:OO******** ******@TK2MSFTN GP12.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*******@hotm ail.com> wrote in message
news:Oc******** ******@TK2MSFTN GP12.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******** ******@TK2MSFTN GP11.phx.gbl...
Hi Pei,

Override OnClosing method.

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

"pei_world" <pe*******@hotm ail.com> wrote in message
news:OO******** ******@TK2MSFTN GP12.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
19018
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, frmBrowseNegsSubform. I would like to perform an ascending or descending sort on any of the 7 columns shown in datasheet view in the subform control. I've been unsuccessful. Is there something tricky about sorting in subform controls?
2
2098
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
5411
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 that), the popup window will have also a text box and a button. when the User click on the button the value on the textbox will be send back to the textbox on My_WUC. I hope I was clear off what I want to do. I've been searching for some ideas...
10
5824
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: WebForm1.aspx ChangeValue.aspx WebUserControl1.ascx Module1.vb
7
3115
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 as follows: Friend F0 As frmMain Friend F1 As frmStart Friend F2 As frmSearch Then in my ShowPage routine (which is passed a string "pageToShow" which is the name of the form I wish to open), I first check to see if we already have an instance...
7
6327
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
1737
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 got a DOS box that showed some progress info. I then decided to add a form... So I made a new application and started with creating the form. Then I copied and pasted cpp code into places where I thought they should go - leaving out the stuff...
3
4156
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 tab control at the top of the form which would allow the user to select (PERSONAL), (TRAINING),(DISIPLINARY),and (SICKLEAVE) Tabs. Each Tab should open a FORM and display the relavant TABLE of records tied to the Employee being viewed in the...
9
2434
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 another form. Problem is if I wake a tooltip when the window is floated, and then try the same thing when it is reparented, the app crashes with " Cannot access a disposed object.Object name: 'Form'. Presumably, this is a result of the tooltips...
1
1779
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 has an axCalendar control. I have two buttons on the form as well, PostDate and Close. PostDate successfully populates the double clicked field with the date of the axCalendar. Close closes the Modal Popup form. 1) How do I get the Modal Popup...
0
9691
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
10505
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...
1
10253
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
9090
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...
0
6813
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5471
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
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
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
2945
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.