Open Form2 (vb.net)

March 16, 2006 at 20:22:42
Specs: XP, AMD 64+ , 1gb
Hello Everyone.

I am making a program in vb.net and am having trouble working out how to open a new form from a button in the app. Heres what i meen.
When the program starts it has a form asking for a username and password. Once the correct username and password has been entered i need the app to close the current form and open a different one.
I thought it would be something like

Open.Form2 or Load.Form2
or something with open or load but apparently it's not. Does anyone have any knowledge on how to do this.

Thank You
Grusomhat

This is where you put your signature


See More: Open Form2 (vb.net)

Report •


#1
March 17, 2006 at 18:39:41
You create a new instance of the Form2 class, then call its 'Show' method.

Dim form as New Form2()
form.Show 'or form.ShowDialog() for Modal forms

Good luck,
-SN


Report •

#2
March 17, 2006 at 20:06:17
Thanks that works perfectly one more question i want to hide the first form and i tried the same thing but using form.hide and it doesnt work it gives an error. Any Ideas

Report •

#3
March 17, 2006 at 20:13:50
It would be pretty helpful for you to post the error...

form.Hide() should work, but I don't know if you can hide the main form. You should use Close() if you don't plan on using the form again.

-SN


Report •

Related Solutions

#4
March 17, 2006 at 20:47:47
It doesn't error anymore but it doesnt work either I have tried using close() but that closes bothe forms. I have also tried Form.Visible = False but no luck. Is there a command to minimise it as that wood be suffiecient.

Thanks


Report •


Ask Question