Micheal
Micheal

Reputation: 5

How can I un-hide the main form when a sub-form closes?

I'm trying to make a VB.net program and I have added this code to the main form:

Me.Hide()

When Form2 opens, the main form hides itself, but if I close Form2 the main Form won't reappear, though I can see it in the Task Manager.

What should I add to make the main form appear again if Form2 closes?

Upvotes: 0

Views: 53

Answers (1)

Justin Ryan
Justin Ryan

Reputation: 1404

Use Form2's FormClosing event to show your main form.

Private Sub Form2_FormClosing(sender as Object, e as FormClosingEventArgs) Handles Form2.FormClosing
    Form1.Show()
End Sub

Upvotes: 1

Related Questions