Reputation: 519
Sorry for asking a really dumb question. I've been a vb6 programmer for years and I am just developing my first application in VS2010.
I'm trying to open a new form on a button click and close the current form.
In VB6 I would have used.
Me.Close
Form.Show vbmodal
I've googled for a solution and it tells me the code is basically the same
form.show()
me.close
However, when I click the button the program closes. If I take away me.close
, the form shows.
I'm really confused.
Thanks
John
Upvotes: 3
Views: 68903
Reputation: 1
Dim f As New Form1
f.Show()
Checked!! as you see I declare f as new Form1, here you have to change with your form name under form properties then the next line is to show the copy of f!
Upvotes: 0
Reputation: 216293
If the form that you are closing is the one that starts your application ('startup form'), then your application ends.
Try with
Me.Hide()
form.Show()
But you could also change the Property Shutdown mode
for the project.
On the Applications Tab
set the Shutdown mode
to When the last form closes
.
Of course, in this case, the order of the commands should be
form.Show()
Me.Close()
Upvotes: 9