Opening new windows  
Author Message
Visual Basic Expert





PostPosted: Visual Basic Express Edition, Opening new windows Top

I'm trying to design a program that opens a new form when you click a button. I've designned two forms. (Form1.vb, Opening form and Form2.vb) I have button1 located at the middle of Form1.vb . I want Form2.vb to open when I click Button1.

Any Help



Visual Studio Express Editions35  
 
 
Brendan Grant





PostPosted: Visual Basic Express Edition, Opening new windows Top

Double click on your button on Form1 to create an event handler and then within add:

Dim myform as new Form2()
myform.Show()

With these two simple lines you'll create a new instance of your second form and display it. If you want the displaying to prevent the user from working with Form1 until Form2 is closed, change Show() to ShowDialog().

Does this work for you