How to determine reason for a form closing

  • Thread starter Thread starter Eidolon
  • Start date Start date
E

Eidolon

In "classic" VB, you could easily determine (on one of the events) why a
form was being closed. For example, "Workstation Shutdown", "App
termination", "X button clicked", etc. How can you do this in .NET?
Specifically i am looking to determine when the user clicks the X button
on the title bar, i want to override the behaviour of that button so that
instead of closing the form, it simply hides the form.
Is there any intrinsic way to do this in VB.NET as in VB6, or is it now
necessary to actually sub-class the window and watch for the associated
message of that button?

Thanks in advance,
- Aaron.
 
Used Mr. Tickles code below, and it worked fine (thread: System Command
Menu).
Thanks to him.
 
Back
Top