Reputation: 15699
Is there any way to call a function in C# when the user exists the application?
I'm using Visual C# 2008 Express edition.
Thanks.
Upvotes: 0
Views: 386
Reputation: 754
I've never tried it so this may be a shot in the dark, but couldn't one override the default exit method and do something like protected override exit {myMethod(); base(e);} Though I'm assuming delegation does essentially the same thing in this case
Upvotes: 0
Reputation: 9258
It's a windows forms applications, isn't it? You can use this event:
System.Windows.Forms.Application.ApplicationExit += ...
Upvotes: 4