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.
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,602
Location
Sydney, Australia
Programming Experience
10+
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.
 

Mohd Syahmie

New member
Joined
Jan 23, 2012
Messages
1
Programming Experience
1-3
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
 
Top Bottom