Console close event?

Jaxbot

Newcomer
Joined
May 2, 2008
Messages
9
Hi.

How do I tell when a console application is being queried to close in VB.NET?

For a windows forms app, I normally do:

Code:
Private Sub ShutdownApp() Handles Me.FormClosing
        'blah blah save etc
End Sub

How would I do this in a console application, and is it possible?

Thanks.
 
IIRC console applications don't have the standard window events (probably because they don't run as part of the window manager).

You could possibly try handling the AppDomain.CurrentDomain.DomainUnload event.
 
Error 'Handles' in modules must specify a 'WithEvents' variable qualified with a single identifier.


I tried doing Dim Withevents app as AppDomain, but I still got the same error.

Any ideas?
 
Back
Top