VB .NET UnLoad event question

Soldato
Joined
17 Dec 2006
Posts
8,245
Trying to make a simple program, after getting a little bored and getting the free Express Edition from Microsoft's website. It's going well but I'm stuck trying to figure out something.

I remember in the older versions I'm sure it had a feature that allowed you to handle events using Form1_UnLoad but in VB .NET it doesn't appear to have this. The reason I want to do this is because I want to do something when the user presses the "X" button, the example is:

User loads Form1
User pressed a button to open Form2
Form2 hides Form1 from sight
Cancel button on Form2 closes Form2 and unhides Form1

The problem is if they press "X" button on Form2, it obviously closes the form but since no code is linked to the button it doesn't unhide Form1 and the program remains hidden until you have to end it using the Task Manager. I've googled and found there apparantly is a event called Form2_Closing but this as well as UnLoad doesn't appear to be in VB.NET 2008 Express Edition so I'm kinda stuck on what to do.

How do I write code into the X button so I can unhide Form1 when the user presses the Cancel button on Form2?

Thanks!
 
Back
Top Bottom