Thursday, October 19, 2006

How to custom define ApplicationExit Event

In the main() method, before calling the application.Start.Run() or Application.Run() methods,
include the following line of code

AddHandler Application.ApplicationExit, AddressOf OnApplicationExit

Include another method in the application as follows

VB:
Private Sub OnApplicationExit(ByVal sender As Object, ByVal e As EventArgs)
'your code here.
End Sub
C#:
private void OnApplicationExit(object sender, EventArgs e) {
// Your code here.
}

No comments:

Post a Comment