How to open a new Frame?

liquidspaces

Regular
Joined
Nov 19, 2002
Messages
74
Location
Richmond, VA
I'm currently working on my first project with Visual Basic.NET. I have 2 forms. One is called Form1, the other Form2. There is a button on Form1 that when clicked, needs to close that form and open Form2.

I've searched both the installed help files and the help files at Microsoft. Can anybody help me? All I need is the syntax to open Form2.
 
Since VB.NET is 100% OO you need to do it slightly different. You have to reference the Form2 object before you can show it.

Visual Basic:
'Put this in your button's click event.
Dim frm2 As Form2 = New Form2()
frm2.Show()
 
Forms in .NET are just classes, which inherit from Form. When you remember that they're just classes it helps you understand the differences between them and VB6 forms.

The biggest thing people trip up on is the lack of a default instance of the form, with the same name.
 
Thanks for your help. I have another question about tab controls that I posted in the forum...if you have the time to help, please do!
kevin
 
Last edited:
Back
Top