Sams Teach Yourself Visual Basic 6 in
21 Days
By Greg Perry
Ripped by: Lilmeanman.
Lilmeanman
Digitally signed by Lilmeanman
DN: CN = Lilmeanman, C = US, O = Lilmeanman UNltd, OU =
Lilmeanman UNltd
Reason: I am approving this document
Date: 2004.09.30 17:22:31 -06'00'
About the Author
Greg Perry is a speaker and writer on both the programming and the application sides of computing. He is known for
his skills at bringing advanced computer topics down to the novice's level. Perry has been a programmer and trainer
since the early 1980s. He received his first degree in computer science and a master's degree in corporate finance. Perry
is the author or co-author of more than 50 books, including Sams Teach Yourself Windows 95 in 24 Hours, Absolute
Beginner's Guide to Programming, Sams Teach Yourself Office 97 in 24 Hours, Absolute Beginner's Guide to C, and
Moving from C to C++. He also writes about rental-property management and loves to travel.
Acknowledgments
My thanks go to Sharon Cox, Tony Amico, and the entire staff of Joe Wikert's group who continue to produce only the
best programming books on the market. Joe was with me on my first programming book years ago and I appreciate this
one just as much as the first. Sharon Cox goes to bat for me more than an Acquisitions Editor should and I want Sharon
to know how grateful that I am. In addition, if this book is good, it's more due to Tony's eagle-eye guidance than
anything I've done as an author.
Among the Sams editors and staff who produced this book, I want to send special thanks to the following people who
made this book a success: Jodi Jensen, Maureen McDaniel, Bart Reed, Charlotte Clapp. Special thanks go to the
technical editor, Bob Wasserman.
I just couldn't write a book for Sams Publishing without mentioning Dean Miller and Richard Swadley. In every book
I've written for Sams, they have had a direct influence, some way, in my motivation and gratefulness for being part of
the most outstanding programming book publisher in the business.
My lovely and gracious bride stands by my side day and night. Thank you once again. You, precious Jayne, are
everything that matters to me on earth. The best parents in the world, Glen and Bettye Perry, continue to encourage and
support me in every way. I am who I am because of both of them and I thank them for all that they've done for me.
Tell Us What You Think!
As the reader of this book, you are our most important critic and commentator. We value your opinion and want to
know what we're doing right, what we could do better, what areas you'd like to see us publish in, and any other words
of wisdom you're willing to pass our way.
As the Executive Editor for the Visual Basic Programming team, I welcome your comments. You can fax, e-mail, or
write me directly to let me know what you did or didn't like about this book—as well as what we can do to make our
books stronger.
Please note that I cannot help you with technical problems related to the topic of this book, and that due to the high
volume of mail I receive, I might not be able to reply to every message.
When you write, please be sure to include this book's title and author as well as your name and phone or fax number. I
will carefully review your comments and share them with the author and editors who worked on the book.
Fax: 317-817-7070
E-mail: vb@mcp.com
Mail: Executive Editor
Visual Basic Programming
Macmillan Computer Publishing
201 West 103rd Street
Indianapolis, IN 46290 USA
Introduction
For the next 21 days, you will learn how to write Windows programs using Visual Basic. You will also have fun along
the way! Visual Basic is an enjoyable language due to its visual environment. Much of building a Windows program in
Visual Basic requires dragging and dropping graphic objects onto the screen from a toolbox which houses those
objects. Your Windows program appears before your eyes as you add the objects. Visual Basic is one of the first
programming languages to incorporate a true WYSIWYG (What You See Is What You Get) environment. The program
that you build looks like the program your users see when they run the program from Windows.
If you've never written a program before, you will successfully learn to program with Visual Basic after you are
through with the next 21-day sessions. Each one-hour lesson covers Visual Basic, from start to finish, in a tutorial style
that includes questions and answers, exercises, and bonus projects that show specific Visual Basic commands and
features in use.
This 21-day tutorial teaches both theory and applies that theory in an easy-to-understand hands-on format. You begin
creating your very first Visual Basic program in the first day's lesson! The goal of teaching Visual Basic to a newcomer
at times is challenging due to today's broad range of computing skills. Some move to Visual Basic after programming
in more advanced (and more tedious) programming languages such as C++. Others come to Visual Basic with only a
QBasic background. QBasic is a language supplied with PCs for years, but QBasic offers only a slow, text-based MS-
DOS programming environment. Despite its archaic text-based mode, the QBasic language provides a wonderful
introduction to Visual Basic because Visual Basic's programming language is an extension of QBasic. Some people
want to program but have never programmed in any other language before, so not only is Visual Basic brand new but
so is the nature of programming.
Visual Basic is much more than just a programming language. The programming language forms the background of all
that takes place in a running Visual Basic program. Nevertheless, the language is a secondary consideration to the user
interface. A Windows program offers a high degree of user interaction using the graphical elements that form the
objects on the window the user sees. If the user interface is not correct, users will not like the program. The
programmer will get more support phone calls. The users will be hesitant to upgrade to future program enhancements.
Therefore, the user interface is stressed throughout these 21 days so that you know exactly how to define the best
interface for your users. Only after you build a usable interface should you then go to work on the program's mechanics
that make the program do the job you designed it to do.
In today's fast-changing world, program maintenance is more critical than ever before. Companies change, industries
consolidate, spin-offs happen. The computer programs of today must be fluid and maintainable so that programmers
can quickly change the program to meet the needs of a changing environment in which the programs are used. This
tutorial stresses the importance of proper program design, coding, testing, and maintenance every step of the way. A
program is written once but updates many times, and you can ease the burden of program maintenance by following a
few general guidelines when you write your program.
This 21-day tutorial strikes a balance between usability and theory, always showing you what you need and not wasting
your time with the tiny fragments of Visual Basic that the typical programmer may never have to know. Importance is
placed on building good programmers who can build good programs that are clear, concise, documented, and simple to
maintain.