Forms and vb.net

C

Cave

Hi

I am just starting to learn visual basic .net and I have a really simple
question.

In vb6, when I wanted to unload one form and show another, I would just type
form2.show
unload form1

In vb.net, How do you show one form and close the original?

I have tried
Dim form2 as new form2
form2.show

This shows the second form, but how do I unload the first? If I add

me.close

onto the two lines of code above, the whole program ends! (not just the
original form closes)

Thanks in advance for any help.
 
W

W.G. Ryan eMVP

I'm guessing Form1 is your startup object. Create a module or other class
that calls Form1 and set it as the startup object. If Form1 is the startup
object, as soon as it closes so does the app.
 
C

Cor Ligthert

Cave,

\\\
dim frm as new form1
frm.show
///

And than there are two forms in the same time open and have to do a lot.

However mostly you want only a kind of dialogform and than it is

\\\
dim frm as new form1
frm.showdialog
frm.dispose
///

When you write me.close you say myself.close

Do when you start, not botter about unloading in VBNet, therefore is in
first case the managed code.

I hope this helps?

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top