Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

Posted

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.

 

'Put this in your button's click event.
Dim frm2 As Form2 = New Form2()
frm2.Show()

Gamer extraordinaire. Programmer wannabe.
  • *Gurus*
Posted

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.

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

Posted (edited)

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

Edited by liquidspaces

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...