Designing Forms in Visual Studio

Revision as of 13:46, 20 July 2007 by Neil (Talk | contribs) (Visual Basic Forms and Controls)

Revision as of 13:46, 20 July 2007 by Neil (Talk | contribs) (Visual Basic Forms and Controls)

The primary purpose of Visual Basic is the development of graphical Windows applications. Given this fact, it is not surprising that an important part of developing with Visual Basic involves the design of Windows Forms. In this chapter of Visual Basic Essentials we will cover in great detail the design of Forms using Visual Studio.

Visual Basic Forms and Controls

The form object is essentially a container for holding the controls that allow the user to interact with an application. Controls are individual objects such as Buttons and TextBoxes. In Visual Basic and Forms we looked at the many options for configuring a Windows Form. We have also looked briefly at adding controls to a form in earlier chapters. In this chapter, however, we will take a much closer look at the steps involved in laying out controls on a Form in Visual Studio.

When a new Windows Application project is created in Visual Studio the first object you will see is a form. Typically it will appear in the design area as follows:

File:Exampl.jpg

Controls are added to the form using the Toolbox. The Toolbox is usually accessed by clicking on the Toolbox tab to the left of the Visual Studio main window. The Toolbox can be pinned in place so that it no longer auto-hides by clicking on the push pin in the title bar. It can also be detached and allowed to float anywhere on the desktop by clicking and dragging on the title bar after applying the push pin. When detached, the Toolbox appears as follows:

Visual Studio Toolbox