-
Closing a window
Okay, I just got started using VB .NET 2003 in a maintenance role and I have to start by fixing the following problem. There is a window in my program that has an exit button. When a user pushes the exit button a procedure is called and "certain things" happen. However, if the user uses the X in the top right corner, or if ALT + F4 is pressed, the procedure is not called which is the problem. How do I tie the exit procedure into the other window closing options?
Thanks...
-
Re: Closing a window
The form has 2 closing events, FormClosed and FormClosing. Move the code that is in the exit button's event to one of these. Then just call close from the exit button.
-
Re: Closing a window
Just note that FormClosing and FormClosed are new in .NET 2.0. In .NET 1.x you would use the Closing and Closed events. Note also that those events will not be raised if you call Application.Exit to quit the app.