Reputation:
I would like my console launch a function when it closing, like that :
Sub Console_Closing(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
But, I'm not using Windows Form but the module, and I can't import Windows Form in the project. Haven't you got an idea ? Tanks ;)
Upvotes: 2
Views: 1861
Reputation: 6491
Use ProcessExit
event of the AppDomain
.
Sub Main
AddHandler AppDomain.CurrentDomain.ProcessExit, AddressOf OnClose
End Sub
Sub OnClose(sender as object, e as EventArgs)
'codeon close
End Sub
Upvotes: 1