Sev
Sev

Reputation: 15699

C# Run Function when User Exits

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

Answers (2)

edude05
edude05

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

Cristian Libardo
Cristian Libardo

Reputation: 9258

It's a windows forms applications, isn't it? You can use this event:

System.Windows.Forms.Application.ApplicationExit += ...

Upvotes: 4

Related Questions