Visual Basic 2005


Add to MY Favorites...

Back to Vicky's Home Page Teaching Home Page Visual Basic 2005 Html For Kids

Forms

Projects will often need more than one form.

This will make a second form in the project.  Add the form, then add whatever labels and controls the form will require. 

  • Pull down the Project Menu, choose Add Windows Form

  • Select the Windows Form icon, type a name for the form, click add.

Create a button on the first form to load the second.  Use this code for the click event

My.Forms.FormName.ShowDialog()

FormName is the name of the form that will open.

There are two ways to open a form.  The difference is whether the use can switch away from the form or not.

ShowDialog method – User can not switch away from the form

Show method - User CAN switch away to another form

 

Create a button on the second form to close it.  Use this code for the click event

Me.DialogResult = Windows.Forms.DialogResult.OK

 


 
Another page developed by
vicky@vickywoodard.com
Copyright © 2006 Vicky K. Woodard
All rights reserved
Last updated: 8/17/2006