Question Two Forms application is closing

NKN

Member
Joined
Dec 9, 2011
Messages
19
Programming Experience
Beginner
I have two forms and a button on the first form. What i want is when i click the button the second form to show and the first one to close.
But this isn't working with:
VB.NET:
Form2.show()
Me.close

All the application is closing with the code above.
 
By default, a WinForms application exits when the startup form closes. You can change that to when the last form closes in the Application page of the project properties.
 
this is the right code

example

Form1 code

form2.show
me.hide


and then Form2 code

form1.show
me.hide

to close the form

click form1 or form2 event

ex.Public form1_formclosing...bla bla bla
application.exit
 
Back
Top