Microsoft Visual Basic 2010 Step by Step eBook

(Tina Meador) #1

110 Part I Getting Started with Microsoft Visual Basic 2010


Your new button is complete, and you have learned how to add your own buttons to the
toolbar, in addition to the default items supplied by Visual Studio. Now you’ll learn how to
delete and rearrange toolbar buttons.

Move and delete toolbar buttons


  1. Drag the new Color button to the left side of the toolbar.


Visual Studio lets you rearrange your toolbar buttons by using simple drag movements.


  1. Right-click the second button in the toolbar (New), and then click the Delete command.


The New button is removed from the toolbar. With the Delete command, you can
delete unwanted buttons, which makes it easy to customize the standard toolbar
buttons provided by the ToolStrip control.


  1. Delete the Save and Print buttons, but be sure to keep the Color and Open buttons.


You’ll learn how to save and print in Chapter 13, “Exploring Text Files and String
Processing,” and Chapter 17, “Working with Printers,” later in the book. Now, however,
you’ll learn to use dialog box controls and connect them to toolbar buttons.

Using Dialog Box Controls


Visual Studio contains eight standard dialog box controls on the Dialogs and Printing tabs
of the Toolbox. These dialog boxes are ready-made, so you don’t need to create your own
custom dialog boxes for the most common tasks in Windows applications, such as opening,
saving, and printing files. In many cases, you’ll still need to write the event procedure code
that connects these dialog boxes to your program, but the user interfaces are built for you
and conform to the standards for common use among Windows applications.

The eight standard dialog box controls available to you are listed in Table 4-2. Note that
the PrintPreviewControl control isn’t listed here, but you’ll find it useful if you use the
PrintPreviewDialog control. (When you’re ready to learn about adding printer support to your
programs, see Chapter 17 .)

TABLE 4-2 Standard Dialog Box Controls
Control Purpose
OpenFileDialog Gets the drive, folder name, and file name for an existing file
SaveFileDialog Gets the drive, folder name, and file name for a new file
FontDialog Lets the user choose a new font type and style
ColorDialog Lets the user select a color from a palette
FolderBrowserDialog Lets the user navigate through a computer’s folder structure and select
a folder
Free download pdf