This documentation is archived and is not being maintained.

Forms Task Changes in Visual Basic .NET

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 and their methodologies. You can use this list to transition your existing Visual Basic 6.0 Forms projects to the new .NET Framework model for Windows Forms.

TaskVisual Basic 6.0 FormsWindows 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 on each control in the desired tab order. For more information, see Setting 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 Determining Which Modifier Key Was Pressed
Align or size controls based on the location and size of a single control.Click on each control to align or size. The last control selected is used to determine the location and size of all controls selected.Click on 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 Aligning 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 on the form's class file in the 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 details, see Displaying 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 details, see Collections in Visual Basic .NET.

See Also

What's New in Windows Forms and Controls | Introduction to Visual Basic .NET for Visual Basic Veterans | Form Positioning Changes in Visual Basic .NET