Forms Tasks for Visual Basic 6.0 Users

There are many differences between Windows Forms and Visual Basic 6.0 forms. The following table provides a list of tasks that can be performed with forms, along with their methodologies. You can use this list to make the transition from your existing Visual Basic 6.0 Forms projects to the .NET Framework model for Windows Forms.

Task

Visual Basic 6.0 Forms

Windows Forms

Set the tab indexing for all the controls on a form.

Select each control on the form, and set its TabIndex property to the next number in the tab order for your form.

From the View menu choose Tab Order. The form displays a numeral next to each control that represents the control's TabIndex property setting. Click each control in the desired tab order. For more information, see How to: Set the Tab Order on Windows Forms.

Determine the modifier key (ALT, SHIFT, CTRL) pressed during keyboard and mouse events.

Use the parameters provided by the mouse event handler.

Compare the form class's ModifierKeys method against the modifier key value, found in the Keys enumeration. For more information, see How to: Determine Which Modifier Key Was Pressed

Align or size controls based on the location and size of a single control.

Click each control to align or size. The last control selected is used to determine the location and size of all controls selected.

Click each control to align or size. The first control selected is used to determine the location and size of all controls selected. For more information, see How to: Align Multiple Controls on Windows Forms.

Change the name of a form.

Change the name specified in the Name property of the form in the Properties window.

Click the form's class file in Solution Explorer, and then change the Filename property in the Properties window.

Change the run-time display position of a form.

Use the Form Layout window to position the form, or set its Startup property in the Properties window.

With the form selected in the Windows Forms Designer, set the StartPosition property in the Properties window.

Display a form as a dialog box.

In code, use the Show method and specify that the form be displayed modally using the vbModal value.

In code, use the ShowDialog method of the form. For more information, see How to: Display Dialog Boxes for Windows Forms.

Group or layer controls on a form.

Layer the controls within the Frame control. To move the controls as a group, select them all.

Place the controls within a GroupBox control. Moving the group box moves the controls as well.

Iterate through the controls on a form.

Use a control array.

Use the Controls Collection. For more information, see Collections in Visual Basic.

See Also

Concepts

Form Object for Visual Basic 6.0 Users

Control Arrays for Visual Basic 6.0 Users

Reference

Windows Forms Overview

Other Resources

Windows Forms Concepts for Visual Basic 6.0 Users