Jaxbot Posted June 11, 2008 Posted June 11, 2008 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: 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. Quote
Administrators PlausiblyDamp Posted June 12, 2008 Administrators Posted June 12, 2008 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. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Jaxbot Posted June 12, 2008 Author Posted June 12, 2008 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? Quote
Administrators PlausiblyDamp Posted June 12, 2008 Administrators Posted June 12, 2008 At the start try doing a AddHandler Appdomain.Current.DomainUnload, addressof Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.