PC Review


Reply
Thread Tools Rate Thread

How capture when user clicks X in top right corner?

 
 
Ronald S. Cook
Guest
Posts: n/a
 
      29th Aug 2006
In my Windows app, users are clicking on the "X" in the top left corner
instead of clicking File.. Exit. I have code that needs to run prior to the
app shutting down. How can I capture the event when the user clicks the X?

Thanks
Ron


 
Reply With Quote
 
 
 
 
Marina Levit [MVP]
Guest
Posts: n/a
 
      29th Aug 2006
You would have to handle the Closing or Closed events for the form, which is
not the same. However, there are other ways to close the form other then
clicking close. Like, clicking on the icon in the upper left hand corner and
selecting Close, or right clickign on the app in the taskbard, and clicking
close.

Make sure the handlers of these events know if the user chose Close off the
file menu, or not. If not, then presumably, you want this code to run. Just
wanted to point out it's not literally about clicking the X.

"Ronald S. Cook" <(E-Mail Removed)> wrote in message
news:OiZtF%(E-Mail Removed)...
> In my Windows app, users are clicking on the "X" in the top left corner
> instead of clicking File.. Exit. I have code that needs to run prior to
> the app shutting down. How can I capture the event when the user clicks
> the X?
>
> Thanks
> Ron
>



 
Reply With Quote
 
Markus Stoeger
Guest
Posts: n/a
 
      29th Aug 2006
Ronald S. Cook wrote:
> In my Windows app, users are clicking on the "X" in the top left corner
> instead of clicking File.. Exit. I have code that needs to run prior to the
> app shutting down. How can I capture the event when the user clicks the X?


override the OnClosing method in your Form.

hth,
Max
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
confirmation window once user clicks submit on user from sam Microsoft Excel Programming 4 7th Jul 2009 06:02 PM
How to capture Mouse clicks and Keystrokes in a VB app =?Utf-8?B?VEM=?= Microsoft VB .NET 2 1st Nov 2006 04:24 AM
Capture server event when a user clicks a <TD>? =?Utf-8?B?RGF2ZQ==?= Microsoft ASP .NET 1 11th Feb 2005 03:24 AM
Show user defined commandbarButton when the user right clicks on Contact Venugopal Microsoft Outlook Program Addins 3 19th Nov 2003 12:49 PM
Re: HOW TO: Capture when a user clicks on the Control Box Michael Mayer Microsoft C# .NET 0 1st Aug 2003 08:52 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:02 PM.