Rummaging Through the Toolbox

The Toolbox is a container for all the controls that you can add to a Windows Forms application or a Windows Presentation Foundation (WPF) application. By default, the Toolbox is located on the left side of the integrated development environment (IDE). If the Toolbox is not visible, you can click the View menu, and then click ToolBox to display it. The following illustration shows the common controls in the Toolbox.

Common controls in the Toolbox

Toolbox

You can set the Toolbox to automatically hide when you're not using it, or you can set the Toolbox to always be visible in the IDE. This makes it easier for you to see all the controls while you create your application. The controls are not visible on the Toolbox when you are in the Code Editor.

To add controls to your application, you can drag them directly from the Toolbox to the form.

To open the Toolbox and add a control to a Windows Form

  1. On the File menu, click New Project.

    The New Project dialog box appears.

  2. Click Windows Forms Application and then click OK.

  3. If the Toolbox is closed, click the View menu, and then click Toolbox.

    When the Toolbox is hidden, you can see a small tab labeled Toolbox at the upper-left side of the IDE. To make the Toolbox visible, move the mouse pointer over this tab. The Toolbox disappears again when the mouse pointer leaves the Toolbox.

  4. To cause the Toolbox to stay open, click the pushpin icon in the upper-right corner of the Toolbox.

    NoteNote

    The pushpin icon appears in a horizontal position when it is set to Auto Hide; otherwise, it appears in a vertical position.

  5. Expand the Common Controls tab on the Toolbox if it's not already expanded, and then locate the Button control.

    TipTip

    To sort the controls alphabetically, right-click the Toolbox, and then click Sort Items Alphabetically.

  6. Drag a Button control from the Toolbox to the form.

    NoteNote

    You can also add a control by clicking the control in the Toolbox and then clicking an area of the form, or by double-clicking the control in the ToolBox.

  7. Click the pushpin icon again to hide the Toolbox.

By default, the controls in the Toolbox are organized alphabetically within tabs that contain related controls. To expand a tab, click the plus (+) sign next to the tab name. To collapse an expanded tab, click the minus (-) sign next to the tab name.

The types of controls that are visible in the Toolbox depends on the type of applications that you are creating. For Windows Forms projects, the following tabs are visible in the Toolbox.

Tab name

Description

All Windows Forms

Contains all the standard Windows Forms controls that are available in the Toolbox.

Common Controls

Contains the most common controls that are typically used in Windows-based applications.

Containers

Contains controls that hold other controls, such as GroupBox controls and Panel controls. Containers can help isolate a set of controls from other controls on the form.

Menus and ToolBars

Contains controls that enable you to create menus and toolbars for your application, such as the MenuStrip and ToolStrip controls.

Data

Contains controls that help you easily work with data in your application, such as the DataGridView control.

Components

Contains components that typically do not have a user interface, such as the Timer and the ErrorProvider.

Printing

Contains controls that enable you to provide printing capabilities to an application.

Dialogs

Contains controls that let you use common dialog boxes in your application, such as the SaveFileDialog, FolderBrowserDialog and FontDialog controls.

You will learn more about the controls on these tabs when you create Windows Forms applications in Creating the Visual Look of Your Program: Introduction to Windows Forms.

Windows Presentation Foundation (WPF) provides new techniques for developing enhanced graphical user interfaces. When you create a WPF application, several WPF controls become available on the Toolbox. These controls are also grouped onto several tabs. When you are creating a WPF Application project, the following tabs are visible in the Toolbox.

Tab name

Description

All Controls

Contains all the standard WPF controls that are available in the Toolbox.

Common Controls

Contains the most common controls that are typically used in WPF applications.

All Containers

Contains controls that hold other controls, such as Canvas and Frame controls. Containers can help isolate a set of controls from other controls on the form.

Common Containers

Contains the most common containers that are typically used in WPF applications

Menus and ToolBars

Contains controls that enable you to create menus and toolbars for your application, such as the Menu and ContextMenu controls.

You will learn more about the controls on these tabs when you create WPF applications in Creating the Visual Look of Your Program: Introduction to Windows Presentation Foundation.

In this lesson, you learned how to navigate the Toolbox and how to add a Toolbox item to a Windows Forms application.

In the next lesson, you will learn how to set the properties of controls by using the Properties window.

Next Lesson: Setting Properties: Using the Properties Window.

Show: