Reputation: 1830
I have two forms named:
Form1 & Form2
In the Form1 I have a button with this code in the button click event:
Form2.Show()
Me.Dispose()
When I click this button, it close both forms at the same time.
I only need to close the Form1.
Upvotes: 1
Views: 591
Reputation: 31393
Your project settings are probably set to terminate the application when the startup form closes. Changing the option to "last form closes" should fix this.
"Project" menu -> 'YourApp' Properties... -> Application Tab
find : "Shutdown Mode"
Change from "When startup form closes" --> "When last form closes"
Upvotes: 4