Windows Develop Bookmark and Share   
 index > Windows Forms Designer > Handle Form.FormClosed() event
 

Handle Form.FormClosed() event

Hi,

I want to handle the Form.formClosed() event into my form.

I have a system tray Notify Icon in my application. So, I want to develop that when user will click on close button of form control box, the form is going to be hide and the notify icon will display into the system tray.

If user wants to quit from the system then the only way is right click on the notify icon into the system tray and click on Exit button at that time Form.Disposed is called.

Please help me ASAP.

Thanks in advance.
Regards Ashlesh,
Ashlesh Patel  Wednesday, April 01, 2009 9:17 AM
Hi,

here is code example:

// This code is in your form class.

protected
override void OnClosing(CancelEventArgs e) { //base.OnClosing(e); e.Cancel = true ; // Set Cance to true to prevent application from closing. Hide(); // Hide the form. } private void toolStripMenuItemExit_Click(object sender, EventArgs e) { Application.Exit(); } private void showToolStripMenuItem_Click(object sender, EventArgs e) { Show(); }

Tomi Airaksinen - MCPD [Remember to click "mark as answered" when you get a correct reply to your question]
Tomi Airaksinen  Wednesday, April 01, 2009 9:32 AM
Hi,

here is code example:

// This code is in your form class.

protected
override void OnClosing(CancelEventArgs e) { //base.OnClosing(e); e.Cancel = true ; // Set Cance to true to prevent application from closing. Hide(); // Hide the form. } private void toolStripMenuItemExit_Click(object sender, EventArgs e) { Application.Exit(); } private void showToolStripMenuItem_Click(object sender, EventArgs e) { Show(); }

Tomi Airaksinen - MCPD [Remember to click "mark as answered" when you get a correct reply to your question]
Tomi Airaksinen  Wednesday, April 01, 2009 9:32 AM
I wonder why the code layout looks so strange after submitting it?!? :(
But anyways, I hope you get the point...
Tomi Airaksinen - MCPD [Remember to click "mark as answered" when you get a correct reply to your question]
Tomi Airaksinen  Wednesday, April 01, 2009 9:36 AM
Hi Tomi,

I tried this out.

It is really what I want. It has solved my issue.

Thanks.
Regards Ashlesh,
Ashlesh Patel  Wednesday, April 01, 2009 9:48 AM

You can use google to search for other answers

Custom Search

More Threads

• How to register an activex control
• single event to trigger multiple dynamically created controls
• Component not shown in design mode
• lasso selectable grid
• Are u Expert of WinForms? Run Time Designing & MSI Creation... must read my message...
• How to access methods of MDI Child form by MDI Parent toolbar?
• Loading form ...
• Signed assemblies and asmmeta file conflict?
• Dictionary type and serializtion problem in VS2005
• ContextMenuStrip MenuItem Click event isn't triggered?