Showing forms

andycharger

Well-known member
Joined
Apr 2, 2003
Messages
152
In VB, you used to be able to show and hide forms like this:

form1.show
form2.hide

I have a button on my main form and It want the button to show the second form and hide the first. What is the code for this in VB.net?
 
That is fine but how do I hide the first form?
I have written the following:

Code:
Dim MyForm as New form2
MyForm.show

But how do I hide the original form?

I am new to programming.
 
You can try this.

Imagine your main form is called Form1 and your second form is called Form2

Do the following steps and it shd work:

Dim frmSecond As New Form2()
Me.Hide()

frmSecond.Show()


Your can also try instead of frmSecond.Show(), use
frmSecond.ShowDialog()
 
Back
Top