Getting started
Adding a visual control
The Toolbox in the Visual Basic IDE contains a wide range of
visual controls which are the building blocks of your applications.
Using the project created on the previous page follow these steps
to start using the Toolbox now:
The Toolbox will
l 1 Place the cursor over the
vertical Toolbox tab at
the left edge of the IDE
automatically hide when
you click on another part window, or click View,
of the IDE but it can be Other Windows,Toolbox
fixed in place, so it will on the Menu Bar, to
never hide, using the Pin display the Toolbox
icon on the Toolbox bar. contents. The visual
controls are contained
under various category
headings beside an
expansion arrow
l 2 Click on the Common
16
Controls category heading
to expand the list of most
commonly used visual
controls. Usefully each
control name appears
beside an icon depicting
that control as a reminder.
You can click on the
category heading again,
Any pinned Window in to collapse the list, then
the IDE can be dragged
expand the other categories
from its usual location to
to explore the range of
any position you prefer.
Drag back to the initial controls available to build
location to re-dock it. your application interfaces
contd
l 3 Clickndrag the Button item from the Common Controls
category in the Toolbox onto the Form in the Designer
window, or double-click the Button item, to add a Button
control to the Form
A Button is one of the
most useful interface
controls your program
determines what happens
when the user clicks it.
The Button control appears in the Form Designer surrounded by
handles which can be dragged to resize the buttons width and
height. Click the Start Debugging button, or press F5, to run the
application and try out your button.
17
This Button control
performs no function
when its clicked until
you add some code.
The Button control behaves in a familiar Windows application
manner with states that visually react to the cursor:
Default State Hover State Down State