Sams Teach Yourself Visual Basic 6 in 24 Hours / Edition 1

Other Format (Print)
Buy New
Buy New from
Used and New from Other Sellers
Used and New from Other Sellers
from $1.99
Usually ships in 1-2 business days
(Save 95%)
Other sellers (Other Format)
  • All (71) from $1.99   
  • New (7) from $21.74   
  • Used (64) from $1.99   


The niche of this book is that it not only focuses on the topic at hand but it also provides a battery of tools/skills that will take the user at a higher level and help him/her realize the skills "without waiting to read another book" on some other topic they need to know if they wanted to implement it in real life. It is a self contained, stand alone book. Teach Yourself Visual Basic 6 in 24 Hours follows the step-by-step approach of the Teach Yourself series and gives the reader a quick, concise introduction to this programming language. It will explain the basics of Visual Basic through task-oriented examples and a hands on approach. Topics covered include: Basics of Visual Basic development, Understanding the concepts of properties, methods, and events, Creating and implementing ActiveX controls, Integrating data into applications, Adding and manipulating graphics, Testing and debugging applications, Printing from your applications.
Read More Show Less

Product Details

  • ISBN-13: 9780672315336
  • Publisher: Sams
  • Publication date: 5/28/1999
  • Series: Sams Teach Yourself Series
  • Edition description: BK&CD ROM
  • Edition number: 1
  • Pages: 480
  • Sales rank: 1,464,559
  • Product dimensions: 7.32 (w) x 8.97 (h) x 1.10 (d)

Meet the Author

Greg Perry has been a programmer and computer trainer for more than 10 years and he is renowned for his ability to explain complex computer topics to new users. He has authored many programming titles for Macmillan including Teach Yourself Visual Basic 5 in 24 Hours, Teach Yourself Microsoft Office 97 in 24 Hours, Teach Yourself Windows 95 in 24 Hours, and Visual Basic 4 in 12 Easy Lessons.

Read More Show Less

Table of Contents

Sams Teach Yourself Visual Basic® 6 in 24 Hours


    • Who Should Read This Book
    • What This Book Will Do for You
    • Can This Book Really Teach Visual Basic in 24 Hours?
    • What You Need
    • Files on the Visual Basic Distribution CD-ROM
    • Conventions Used in This Book
    • Enough! Time Is Ticking!



    • What's Visual Basic About?
    • Languages
    • Visual Basic's Various Editions
    • The VB Programming Process
    • Starting Visual Basic
    • Stopping Visual Basic
    • Mastering the Development Environment
    • Help Is at Your Fingertips
    • Summary
    • Q&A
    • Workshop


    • Event-Driven Programs
    • Control Events
    • Analyzing Sample Applications
    • Naming Objects
    • Running Applications
    • Where's the Code?
    • Event Procedures
    • Properties and Event Procedures
    • Generating an Application from Scratch
    • Summary
    • Q&A
    • Workshop


    • Creating New Applications
    • Controls Provide the Interface
    • Giving Your Users Help
    • Named Literals
    • Take a Break!
    • Summary
    • Q&A
    • Workshop


    • Understanding Control Focus at Runtime
    • The Mouse and Hotkeys Need No Focus
    • Related Properties
    • Tab Order
    • Command Buttons
    • Labels
    • Text Boxes
    • Form Properties
    • Summary
    • Q&A
    • Workshop



    • Coding Basics
    • Data Basics
    • Expressions and Math Operators
    • Summary
    • Q&A
    • Workshop


    • A Function Preview
    • A MsgBox() and InputBox() Overview
    • Visual Basic's Code Window Help
    • A Short Detour: Remarks
    • Examining InputBox()
    • Summary
    • Q&A
    • Workshop


    • Comparison Operators
    • The If Statement
    • The If Statement's Else Branch
    • Compound Comparisons with the Logical Operators
    • Multiple Choice with Select Case
    • Two Additional Select Case Formats
    • Summary
    • Q&A
    • Workshop


    • The Do While Loops
    • The Do Until Loop
    • The Other Do Loops
    • The For Loop
    • Summary
    • Q&A
    • Workshop



    • The Interest Calculation Application
    • Using Control Arrays
    • Finishing the Form
    • Adding Code
    • The Unload Statement
    • Finishing Touches
    • Error Checking
    • Summary
    • Q&A
    • Workshop


    • The List Box Control
    • Combo Boxes
    • Data Arrays
    • Control Arrays
    • Summary
    • Q&A
    • Workshop


    • Option Buttons
    • Frames and Option Buttons
    • Check Boxes
    • Scrollbars
    • VB's Clock: The Timer Control
    • Summary
    • Q&A
    • Workshop


    • What the Common Dialog Box Does
    • Adding the Common Dialog Box Control
    • Generating Common Dialog Boxes
    • The Common Dialog Box Methods
    • Adding the File Dialog Boxes
    • The Color Dialog Box
    • The Font Dialog Box
    • The Printer Dialog Box
    • Summary
    • Q&A
    • Workshop



    • Structured Programming
    • Calling Procedures and Returning from Them
    • Coding Subroutines
    • Coding Functions
    • Coding Arguments
    • Receiving by Reference and by Value
    • Summary
    • Q&A
    • Workshop


    • Many Functions
    • Numeric Functions
    • String Functions
    • Date and Time Functions
    • Data-Testing Functions
    • Data Conversion Functions
    • Format Function
    • Summary
    • Q&A
    • Workshop


    • File Concepts
    • Introduction to Database Processing
    • The Data Form Wizard
    • Summary
    • Q&A
    • Workshop


    • Introducing Printing
    • Preparing the User for Printing
    • Introducing the Printer Object
    • The Print Method
    • Starting to Print
    • Summary
    • Q&A
    • Workshop



    • The Menu Editor
    • Adding an Application's Menu Bar
    • Naming Menu Options
    • Adding Pull-Down Menu Options
    • Menu Extras
    • Connecting Menus to Event Procedures
    • Copying Menus Between Projects
    • Summary
    • Q&A
    • Workshop


    • The Image Control
    • The Picture Box Control
    • Animating Pictures
    • Summary
    • Q&A
    • Workshop


    • Preparing for the Toolbar
    • The Image List Control
    • Finalizing the Toolbar
    • The Line and Shape Controls
    • Summary
    • Q&A
    • Workshop


    • Kinds of Errors
    • The Debugger
    • Setting Breakpoints
    • Stepping Through Code
    • The Call Stack Shows Where You've Been
    • The Immediate Window
    • Summary
    • Q&A
    • Workshop



    • ActiveX: The Tools You Use
    • Building ActiveX Controls With VB
    • OLE Processing
    • ActiveX Documents
    • Summary
    • Q&A
    • Workshop


    • The System Objects
    • Program Objects
    • Using Collections and Object Arrays
    • Introduction to OLE Automation
    • Summary
    • Q&A
    • Workshop


    • Compiling Your Application
    • Setting Project Properties
    • Setting Up Your Application
    • Starting the Package And Deployment Wizard
    • Running Setup
    • Uninstalling the Application
    • Summary
    • Q&A
    • Workshop


    • Follow the Wizard to the Web!
    • Your Users Need an ISP
    • Using the Browser
    • Looking Through the Other Tools
    • Summary
    • Q&A
    • Workshop




    • Hour 1 Quiz
    • Hour 1 Exercise
    • Hour 2 Quiz
    • Hour 2 Exercise
    • Hour 3 Quiz
    • Hour 3 Exercises
    • Hour 4 Quiz
    • Hour 4 Exercises
    • Hour 5 Quiz
    • Hour 5 Exercises
    • Hour 6 Quiz
    • Hour 6 Exercises
    • Hour 7 Quiz
    • Hour 7 Exercises
    • Hour 8 Quiz
    • Hour 8 Exercises
    • Hour 9 Quiz
    • Hour 9 Exercises
    • Hour 10 Quiz
    • Hour 10 Exercises
    • Hour 11 Quiz
    • Hour 11 Exercises
    • Hour 12 Quiz
    • Hour 12 Exercises
    • Hour 13 Quiz
    • Hour 13 Exercises
    • Hour 14 Quiz
    • Hour 14 Exercises
    • Hour 15 Quiz
    • Hour 15 Exercises
    • Hour 16 Quiz
    • Hour 16 Exercises
    • Hour 17 Quiz
    • Hour 17 Exercises
    • Hour 18 Quiz
    • Hour 18 Exercises
    • Hour 19 Quiz
    • Hour 19 Exercises
    • Hour 20 Quiz
    • Hour 20 Exercises
    • Hour 21 Quiz
    • Hour 21 Exercises
    • Hour 22 Quiz
    • Hour 22 Exercises
    • Hour 23 Quiz
    • Hour 23 Exercise
    • Hour 24 Quiz
    • Hour 24 Exercise


    • Windows 95/NT 4 Installation Instructions
    • System Requirements


Read More Show Less

First Chapter

[Figures are not included in this sample chapter]

Sams Teach Yourself Visual Basic® 6 in 24 Hours

Hour 3

Controls and Properties

Nobody can master Visual Basic until he masters controls and properties. The form
is the placeholder for the controls, and the controls are the really important parts
of any application. Many of the properties require different kinds of values, and
you will learn in this hour's lesson how to set those values.

Before you finish this lesson, you also will have created your very first application
from scratch without the aid of the VB Application Wizard. You will have created
a new project, sized the form, added controls, set control properties, and even written
an event procedure using the Visual Basic programming language. As you'll soon see,
Visual Basic makes all those tasks simple.

The highlights of this hour include

  • What steps are required for application creation

  • How to place and size controls

  • Why various properties require different setting methods

  • Which naming prefixes work best

  • Why your application's ToolTips give users added help

Creating New Applications

When you create an application from scratch instead of using the VB Application
Wizard to generate the program shell, you control every aspect of the application's
design and you place all the program's controls on the form yourself. When you place
those controls, you must name the controls, position the controls, set control properties,
adjust the control sizes, and hook up all the event procedure code that goes with
each control.

All this may sound daunting, but Visual Basic simplifies things as much as possible.
Although the task isn't quite as simple as running the wizard, you have the power
to create the exact application you need. Newcomers need to learn how to create applications
without the wizard so they can fully master all the ins and outs of Visual Basic.

To create a new application from scratch, start Visual Basic and double-click
the Standard EXE icon. The blank Form window appears in the work area's upper-left
corner next to the toolbox, ready for you to begin creating the application by placing
the controls.

TIP: The default Form window size is fairly small, especially when you realize
that the Form window holds the application's background. Most applications appear
either full-screen or in an initial window much larger than the Form window size
that appears. Therefore, one of the first tasks you will usually perform is to increase
the Form window's size.

If you double-click the Form window's title, Visual Basic expands the Form window
to full screen. However, with your toolbox and other windows on the screen, you'll
have to use the scrollbars to access various parts of the form. Of course, if your
application is full screen, you'll need to work with the scrollbars to add controls
to the full form.

NOTE: This book's Form windows typically remain a size at which you can see
the entire form as well as the surrounding windows. Therefore, most of the applications
in this book contain fairly small Form windows. The book's Form windows will be larger
than the default size that appears when you first start Visual Basic, but the Form
windows will be far smaller than full screen.

Controls Provide the Interface

The controls you select for your application's form are important because the
controls (also called tools) provide the application interface for your users. Users
interact with your application by clicking the controls and entering text in the
controls. Placing and sizing controls are perhaps the two most important tasks you
can master at this point.

Placing Controls

After you increase the Form window to a reasonable size, your job is to place
controls on the form. Use either of these two methods for placing controls on the

  • Double-click any control on the Toolbox window to place that control on the Form
    window. As Figure 3.1 shows, the control appears in the center of the Form window.

FIGURE 3.1. The command button appears in the center of the Form window.

  • If a control appears in the center of the form already, the new control will
    be on top of the existing control. You can drag the new control to a different location.
    The eight sizing handles (the small boxes that appear around a selected control)
    indicate that the control is selected. If several controls appear on the Form window,
    the selected controls will display their sizing handles. (Typically, only one control
    will be selected at any one time but you can select multiple controls by holding
    the Ctrl key and clicking several controls.)

  • If you click a toolbox control once, the toolbox highlights the control. If you
    then move the mouse cursor to the Form window, the mouse cursor turns into a crosshair
    indicating that you can place the selected control anywhere on the form. Although
    a control appears in the center of the Form window automatically as soon as you double-click
    the control, a selected control appears only when you click and drag your mouse crosshair
    on the Form window. The final control appears when you release the mouse.

  • The advantage of using this approach to placing controls over the first approach
    is that you don't have to move and resize the control after you've placed it. Figure
    3.2 shows Figure 3.1's command button placed in the center of the form with a double-click,
    as well as a new command button placed on the form by dragging the control. You can
    place the control exactly where you want it and at the size you want it when you
    drag the control onto the form.

FIGURE 3.2. The second command button is placed and sized immediately.

Sizing and Moving Controls

You can change the size of only a selected control. The eight sizing handles are
the key to resizing the control. You can drag any of the eight sizing handles in
any direction to increase or decrease the control's size. Of course, if you placed
a control on the form by dragging the control, you won't need to resize the control
as often as you would if you double-clicked the toolbox tool to place the control.

You can move a selected control to any area of the Form window by dragging the
control with your mouse. After you click to select a control, click the control and
hold down the mouse button to drag the control to another part of the Form window.

Sometimes you might want to drag several controls to a new location as a group.
For example, perhaps you've placed a set of command buttons at the bottom of a form
and after adjusting the Form window's size, you determine that you need to move the
buttons down some. Although you can move the command buttons one at a time, you can
more quickly select all the command buttons and move them as a group.

In addition, you can lasso the controls by dragging a selection rectangle around
the controls you want to select as a group. When you release your mouse, the controls
within the selected region will be selected, like those shown in Figure 3.3.

FIGURE 3.3. Selecting multiple controls when you want to move the entire
group at once.

TIP: Remember how to select multiple controls if you find yourself needing
to change properties other than the location of controls. If you select multiple
controls before changing a control property, all controls in the selected range will
take on that new property value. You can only change the common properties that appear
in all the selected controls.

Setting Properties

As you add controls to the Form window, the Properties window updates to show
the properties for the currently selected control. The selected control is usually
the control you last placed on the form. Visual Basic lets you see a control's properties
in the Properties window by clicking to select the control or by selecting the control
from the Properties window's drop-down list box, as shown in Figure 3.4.

FIGURE 3.4. Selecting the control to work with.

NOTE: Visual Basic programmers often use the generic term object to
refer to controls, forms, menus, and various other items on the screen and in the

The Left, Top, Height, and Width properties
are about the only properties you can set without accessing the Properties window.
As you size and move a control into place, Visual Basic updates the Left,
Top, Height, and Width properties according to the control's
placement on the Form window and the control's size. As with the form location and
size measurements, these properties appear in twips (unless you specify a different
value in the ScaleMode property). Left indicates how far from the
form's left edge the control appears, Top indicates how far from the top
of the form the control appears, and the Height and Width properties
indicate the control's size.

NOTE: Even the form has properties. Click your Form window and look at the
Properties window. The form will be the selected object at the top of the Properties
window (Form1 is the default name for an application's initial form).

After you place and size a control, the first property you should modify is the
Name property. Although Visual Basic assigns default names to controls when
you place them on the Form window, the default names don't indicate the control's
true purpose in your application. In addition, the default names don't contain the
three-letter prefix that describes the control.

For your reference, Table 3.1 lists common prefixes used for control names. When
you name your Form window's controls, you'll appreciate later that you took the time
to type the three-letter abbreviations at the beginning of the names. Then you'll
be less likely to assign to a text box, a property that belongs to a command button
control inside an event procedure. (Such an assignment will cause a runtime error.)

NOTE: The Name property is so important that Visual Basic lists the
Name property first (as (Name) inside parentheses) in the Properties
window instead of alphabetically in the Properties window, where the other properties


Prefix Control
cbo Combo box
chk Check box
cmd Command button
dir Directory list box
drv Drive list box
fil File list box
fra Frame
frm Form
grd Grid
hsb Horizontal scrollbar
img Image
lbl Label
lin Line
lst List box
mnu Menu
ole OLE client
opt Option button
pic Picture box
shp Shape
tmr Timer
txt Text box
vsb Vertical scrollbar

NEW TERM: A ToolTip is a pop-up description box that appears when
the user rests the mouse pointer over a control.

Some property values you set by typing the values directly in the Properties window.
For example, to enter a value for a control's ToolTipText property, click
once on the Properties window's ToolTipText property and type the ToolTip

Giving Your Users Help

The ToolTip is a great feature that helps your users and is as easy to implement
as typing text into the control's ToolTipText property. Most applications
since the introduction of Windows 95 include ToolTips, and there's no reason why
your applications should not include them as well.

Figure 3.5 shows a ToolTip that appears in Visual Basic when you rest the mouse
pointer over the Form Layout Window toolbar button. The best time to add ToolTip
text is when you adjust a new control's properties because you are more likely to
remember the primary purpose for the control. Often programmers intend to add these
helpful items later, after they "complete" the application, but then the
items are never added.

FIGURE 3.5. The ToolTip pops up to describe the project.

If you want to change a property value, such as the Name property, you
can click the property and enter a new value. As you type, the new value replaces
the original value. If instead of clicking you double-click the property, Visual
Basic highlights the property value and lets you edit the existing value by pressing
your cursor keys and using Insert and Delete to edit the current property value.

TIP: As you select a property, read the text that appears at the bottom of
the Properties window. The text describes the property and serves as a reminder about
what some of the more obscure properties do.

Some properties require a selection from a drop-down list box. For example, Figure
3.6 shows a command button's Visible property's drop-down list box. The
Visible property can either be True or False. No other
values work for the property, so Visual Basic lets you select from one of those two
values when you click the property value to display the down arrow and open the drop-down
list box.

FIGURE 3.6. Some properties require a selection from a list box.

If an ellipsis (. . .) is displayed when you click the property value, such as
the Font property when you click the current Font property's value,
a dialog box opens when you click the ellipsis. A Font property is more
than just a style name or size. The control's Font property can take on
all kinds of values. And the Font dialog box that appears from a click of the ellipsis
lets you specify all available Font property parts. When you close the dialog
box, the compound property is set to the dialog box's specific values.

Some programmers prefer the Categorized view of the Properties window. By default,
the Properties window displays its properties alphabetically (with a possible exception
at the top of the Properties window, such as the Name property). When you
click the Categorized tab above the property values, the Properties window changes
to show the properties in an Explorer tree view such as the one in Figure 3.7.

FIGURE 3.7. These property values appear by category type.

If you needed to change all of a control's appearance values, such as Color
and Caption, you could expand the Categorized view's Appearance
entry to display all the appearance values together. That way, you can change the
appearance more quickly than if you had to search through the alphabetical listing
of properties.

As you can see, placing a control requires much more involvement with property
values than simply moving and sizing the control. You rarely if ever have to change
all the properties of a control because many default values work fine for most applications.
Nevertheless, many property values work to make the control unique to your specific

Named Literals

A named literal, also called a named constant, is a special named value that represents
a fixed value. Visual Basic comes with several named literals and you'll use many
of them in your programs to assign values to controls at runtime.

Consider the drop-down list box that appears when you click a command button's
MousePointer property (see Figure 3.8). The MousePointer property
requires a value from 0 to 15 (or 99 for a custom value).
When you set property values at design time, you simply select from the list, and
the descriptions to the right of the numeric values explain what each value is for.
When programming, you will be able to assign property values to properties when the
user runs the program. Although you can assign 2 to the property value to
change the mouse cursor to a crosshair during one part of the running application,
your code will be better if you assign the named literal vbCrosshair. Although
vbCrosshair is longer to type, you will know what value you assigned when
you look at the project later.

FIGURE 3.8. You can assign a named literal to the MousePointer

We're getting slightly ahead of ourselves discussing runtime property values that
change inside the code, such as event procedures. Nevertheless, keep named literals
in mind as you assign values in the Properties window at design time. The named literals
often closely match their Properties window counterparts.

Take a Break!

In this section, you are going to create a project from scratch without the help
of the VB Application Wizard. You'll create a new project, assign controls, and write
event procedure code to hook everything together. The final application will be simple,
but you'll have little trouble understanding the application now that you've become
more familiar with properties and event procedures.

To create your first application, follow these steps:

1. Create a new project by selecting File|New Project and choosing to
create a new Standard EXE project. Don't save any changes from earlier in this lesson
if you were following along during the discussion of command buttons and control

2. Change the form's Name property to frmFirst and change
its Caption property to My First Application. The form's Caption
property text appears in the title bar when you run the application.

3. Expand the Form window to these property values: Height 7380
and Width 7095. You can either drag the Form window's sizing handles until
the Form window's size coordinates to the right of the toolbar read 7095x7380
or you can set these two property values yourself by changing the values in the Properties
window. If you drag the Form window to obtain this size, you can approximate the
coordinates described here; you don't have to size your Form window exactly to 7,095
by 7,380 twips.

4. Click the Label control once. As you learned in Hour 1, "Visual
Basic at Work," the Label control is the tool with the capital letter A on the
toolbox. When you click the Label control, Visual Basic shows the control depressed
as if it were a command button.

5. Move the mouse pointer onto the Form window and drag a Label control
toward the top of the Form window in the approximate location you see in Figure 3.9.

FIGURE 3.9. A label is this form's first control.

6. Change the label's Name property to lblFirst. Change
the label's Caption property to VB is fun.

7. Click the label's Font property value to display the ellipsis.
Click the ellipsis to display the Font dialog box for the label. Set the font size
to 24 points and set the Bold property. (A point is 1/72 of an inch; 24
points is about twice the height of a word processor's character onscreen.)

As Figure 3.10 shows, the label's text is now large enough to read, but the text
isn't well centered within the label. Change the label's Alignment property
to 2-Center, and the text centers just fine.

FIGURE 3.10. The label needs to be centered.

8. Change the label's BorderStyle property to 1-FixedSingle.
This property adds a single-line 3D border around the label. You'll see that the
label's Height property is too large, so click the label to display its
sizing handles and drag the top edge downward to center the text within the label.

9. Add a command button, but to do so, double-click the command button
tool on the Toolbox window. The command button appears in the middle of the form
and you can leave it where it is.

10. Change the command button's Name property to cmdExit.
Change the command button's Caption property to E&xit. Watch
the command button as you type the Caption property text. The command button's
caption becomes the text you type with one exception: The x is underlined.
When you precede a Caption property's letter with an ampersand (&),
Visual Basic uses that letter for the control's hotkey. Users of your application
will be able to select the command button not only by clicking the mouse, but also
by pressing Alt+X on the keyboard.

11. The command button will be used to exit the program. When the user
clicks the command button, your application should end. What happens when a user
clicks a command button? A Click event occurs. Therefore, to respond to
this event, you must write an event procedure for the command button. Visual Basic
will help you do this. Double-click the form's command button and Visual Basic instantly
opens the Code window and displays the following wrapper lines for the command button's
Click event procedure:

Private Sub cmdExit_Click()

End Sub

You only need to fill in the body. The name of the procedure, cmdExit_Click(),
describes both the control and the event being processed by the code. Type End
for the one-word body of the event procedure and close the Code window. End
is now the very first Visual Basic programming language statement you've learned!
End tells Visual Basic to terminate the running application, so the application
will terminate when the user clicks the command button.

TIP: Indent the body of the code from the surrounding wrapper lines as follows
so you'll be able to distinguish procedures from one another when you read through
a list of them:

Private Sub cmdExit_Click()

End Sub

Press F5 to run the program and watch your creation appear. As shown in Figure
3.11, the form appears with the label and command button in place.

FIGURE 3.11. Your first running application!

Terminate the application by clicking the Exit command button. Visual Basic regains
control. (If you had compiled the application, you could run the compiled .exe
file from the Windows Run command or from an icon if you assign the .exe
file to an icon on the Desktop or to an option on the Start menu.)

When you save the project, Visual Basic saves all the files within the project.
Select File|Save Project. Visual Basic asks for the form's name with a Save File
As dialog box (remember that each element of the project is a separate file). You
can select a different drive or pathname if you want. Save the form module file under
the name Lesson 3 Form (Visual Basic automatically adds the .frm
filename extension). Visual Basic now requests the name of the project with a Save
Project As dialog box. Type Lesson 3 Proj and click Save to save the project
file (Visual Basic automatically adds the .vbp filename extension). If you
were to edit the project, Visual Basic would not need to request the filenames subsequently
now that you've assigned them.

Take a rest before starting Hour 4, "Examining Labels, Buttons, and Text
Boxes." Exit Visual Basic and give your computer's circuits a break as well.
You are well on your way to becoming a Visual Basic guru, so feel good about the
knowledge you've already gained in three short hours.


In this hour you learned how to place controls onto a form and how to size and
move the controls. After you place controls, you must set the control property values
so that the controls take on the values your application requires. (Don't you wish
you could set your real estate property values just as easily?)

The next hour gets specific and describes these three common controls in detail:
command buttons, labels, and text boxes.


Q When do I double-click a toolbox control to place the control on the Form
window and when do I drag the control onto the Form window?

A When you double-click a toolbox control, that control appears on the Form
window immediately. The double-click requires less work from you to place the control
on the form. After the control appears, however, your rest period ends because you
have to move and size the control properly. By first selecting a control and dragging
the control onto the form, you select, size, and move the control in one step.

Q How do I know if a property value requires a value, a selection from a drop-down
list box, or a dialog box selection?

A Just click the property. If nothing happens, type the new property value.
If a drop-down list box arrow appears, click the arrow to see the selections in the
list. If an ellipsis appear, click it to display the property's dialog box.

Q Can I create an initial application with the VB Application Wizard and then
add extra controls to the form?

A Certainly! That's the true reason for using the wizard. The wizard creates
the shell, and then you add to and modify the shell to generate a final application
that meets your specific needs. The only potential problem right now is that the
wizard does generate a fairly comprehensive shell, especially if you add Internet
and database access to the shell. Until you master more of the Visual Basic environment
and language, you might find that locating the correct spots to change is more difficult
than creating the application from scratch.


The quiz questions and exercises are provided for your further understanding.
See Appendix B for the answers.


1. What is the fastest way to place a control on the form?

2. What are a control's sizing handles for?

3. How can you select multiple controls?

4. True or false: Some properties change automatically as you move and resize

5. Which form property sets the title that appears in the form's title bar?

6. What is the difference between an object and a control?

7. When is the best time to add a ToolTip to a control?

8. Why do some controls display an ellipsis when you click certain property


1. Create another application from scratch. Add two command buttons and
one label between them. Make the label's Caption property blank when you
place the label on the form. When the user clicks the first command button, a caption
should appear on the label that reads Clicked!. You'll need to place the
following Visual Basic statement inside one of the application's event procedures
to do this:

lblClick.Caption = "Clicked!"

Save the project and form module so you can modify the application later if you

2. Load the project you created in the previous exercise and add ToolTips
to the two command buttons and to the label button. Run the application and test
the ToolTips to see if they work.

Read More Show Less

Customer Reviews

Average Rating 4
( 7 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Terms of Use.
  • - Barnes & reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing all of 7 Customer Reviews
  • Anonymous

    Posted March 12, 2004

    Horrible book, not recommended

    I purchased this book to learn VB6, and it dosn't teach you it at all. It goes off topic all the time, never goes in depth with things, and expects you to understand every command you're suppose to enter in the code area, as it never explains them. Get something like VB6 For Dummies, as that's a book that actually does the job.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted February 1, 2002

    Good book for the price, could be better.

    Sams Teach Yourself Visual Basic 6 in 24 hours is a good book if you've never touched Visual Basic code. If you are a total beginner, you will be taken to a reasonable understanding of Visual Basic. This book does a great job on creating interfaces with Visual Basic. However, it does not go in depth with coding of applications. By the time I finished the book, I did have an understanding of Visual Basic programming, and I was able to create my own intermediate level programs. Nevertheless, if you are above beginning level in Visual Basic, this book will not do the job. I did find myself needing other resources after the completion of this book. Overall, I give this text 4 stars because it does do partially what it sets out to do- teach beginning level Visual Basic programming.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted November 3, 2001

    Good to start with... that's all

    This book is excellent to get you started in visual basic and nothing more. The book doesn't go into detail at all. Myself being a beginner, I read and tried codes. (many mistakes in the book and the website doesn't post any, so I had to fix them myself) I am on hr. 13 and already had to consult many visual basic websites for correct codes and techniques. The book doesn't tell you for example, how to code check boxes or how to bring about common dialog boxes. The absence of the information turned my attention to other very useful websites, I guess that's a good thing. This book is good up until the hr. 3 where a reader is able to put together the very first visual basic application. The rest should be learned from books of other publishers like Microsoft.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted April 16, 2001

    Great for Starters

    This book helped me with my understanding of VB6 and how the basic components work. I recommend this book for all beginners.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted March 24, 2001


    This book is Excellent. It is written in simple, non-intimidating language. It explains everything step-by-step. If you are new to programming, and truly want to learn Visual Basic, get this book!

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted April 22, 2001

    --14 years old, 8 months programming

    This book is great. The authors made Visual Basic 6 a <i>breaze</i> to learn. I would recommend this book to any one, programmer or non-programmer, to get a copy for themselves if they have even the slightest interset in learning Visual Basic 6. The book isn't that expensive either, and it comes with a CD!

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted April 10, 2000

    Good beginners book

    I found this to be a very good book for someone new to VB. It may not prove as useful to someone who hasn't programmed before, but is an otherwise great tool to begin learning with.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing all of 7 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)