Introduction


Welcome to Visual Basic 5 Night School, a project that combines the best of book-learning, night school, and the Internet to give you a complete course on Visual Basic and will turn you into a Visual Basic programmer in about a month of nightly one-hour lessons. This tutorial is designed to meet today's programming needs. You not only will get to hands-on work right away, but you'll also understand the theory behind that hands-on training.

Unlike most tutorials, if you have questions, you can ask the author and other support staff! Surf the Internet to this book's Web page and view updates, quiz answers, additional links, explanations, tips, traps, and special offers. Leave questions and suggestions for the support staff. Once every month or so during this book's print life, you'll be able to chat with the author so that you can personalize your skills and approach the Visual Basic language asking for answers that you need.

Is This Book for You?

This book is aimed at novice VB programmers with hectic schedules, but who are willing to set aside an hour a night to learn a new programming language that will help them at work. This book is targeted at the same people who are willing to sacrifice their evenings or weekends to take continuing education classes or seminars to further their careers. Rather than go to class, however, you stay at home and follow the class that we bring into your home with this tutorial and the Internet.

If you've worked with Visual Basic before-whether a little or a lot-you will appreciate this book's Fast Track approach. The final five chapters jump head-first into the ocean of Visual Basic programming and helps you develop a complete application from scratch. As you read about the application's development, you can refer to specific references in the earlier chapters that teach each topic in more detail. If you are new to Visual Basic, you will see what the rest of the book teaches; if you're an old pro, you will gain lots of insight into version 5's tools and programming treasure chest.

The Book's Training Format

Several books on the market exist for novice programmers and new Visual Basic programmers. None of them, however, are designed specifically to help readers learn Visual Basic in the environment in which the learning --at home, at night, in less than an hour a day, or crammed into a weekend.

Each chapter consists of three specific topics that help you focus on specific areas. Each topic is arranged in a three-step approach: explaining the concept, providing a relevant example, and providing reinforcement of the example to guarantee that you actually understand the concept.

In addition to the typical approach to teaching programming, this book provides Fast Track sections to point those of you who are more advanced-or more adventuresome-to building a scheduling and contact application. You can jump back to the relevant reference sections whenever you need more assistance.

(d)The CD-ROM

The CD-ROM included in Visual Basic 5 Night School is filled with valuable Visual Basic 5 resource material. Included on the CD-ROM are the following Que titles: Special Edition Using Visual Basic 5, HTML By Example, and VB Script By Example. There's a stand-alone CD-ROM version of the Visual Basic 5 Night School Web site, providing you with interactive quizzes, a Visual Basic FAQ (Frequently Asked Questions document), and the sample application from the book. The CD also contains all source code used in the book in electronic format, providing you with a great cut-and-paste source of Visual Basic code.

The Virtual Classroom Web Site

One of the truly unique features of Visual Basic 5 Night School is that you can get the simulated effects of learning Visual Basic along with a group of your peers. How is this possible? Through the interactive Web site that we have created for this book-the Visual Basic Virtual Classroom. At this Web site (http://www.quenightschool.com), you can talk with fellow Visual Basic 5 Night School readers about the book and VB programming in general, attend a monthly real-time chat hosted by the author, and even have your VB questions answered in real time by the many experienced programmers on the Night School IRC (Internet Relay Chat) channel.

The Web site boasts a wide range of features designed to help you in your Visual Basic 5 education. Interactive quizzes are available to test your knowledge and reinforce your learning. Along with the real-time discussion features, you also have access to a Visual Basic FAQ, providing you the wisdom of other programmers' experiences. You can also submit your own programs for review by your fellow "classmates" in the showcase section of the Web site. A complete virtual classroom awaits you, providing you with invaluable Visual Basic resources and information.

Conventions Used in This Book

This book uses several special conventions that you need to become familiar with. These conventions are listed here for your reference.

This book uses a monospaced typeface for Visual Basic code, to set it off from standard text. If you're told to type something, what you are to type appears in monospaced boldface.

When discussing the syntax of Visual Basic commands, this book uses some special formatting to distinguish between the required portions and the variable portions. Consider the following example:

If conditional Then

   Block of one or more Visual Basic statements

End If


In this syntax, placeholder information is presented in italic; information that must be typed exactly is not in italic. The word conditional indicates a placeholder-that is, in actual code, the word is replaced with whatever condition you actually want the If statement to work with. If, Then, and End If are required because they're keywords within the statement.

In some cases, command information is optional-that is, it's not required for the command to work. Square brackets ([]) enclose optional parts of the command syntax. Consider the following example:

intResponse = MsgBox(strPrompt[, intStyle][, strTitle])


Here, MsgBox is the function name and is neither optional nor a placeholder. The intStyle and strTitle parameters are both variable and optional (they're in italic and enclosed in square brackets); this means that you can type any character string in place of strTitle (without the brackets), or type nothing at all. intResponse and strPrompt are placeholders, but they aren't optional; you must supply a response and a prompt.

Also in this book, you may see a [ccc] character at the beginning of a line of code. This character indicates that the line continues the code line above it. For example,

For intSub = 1 To 35

  strFamilyName(intSub) = 

  [ccc]InputBox("What is the family member's name?")


shows that the strFamilyName(intSub) = line was too long and had to be moved down to the next line. You also occasionally may see an _ at the end of some VB code lines; the underscore is Visual Basic's own code-continuation character:

Private Sub cmdChangePic_Click()

  picPicture.Picture = LoadPicture("VB\Graphics\MetaFile\ _

                       Business\Computer.WMF")

End Sub


Tips, notes, and cautions appear throughout the book in special formats to make the information they contain easy to locate. Longer discussions not integral to the flow of the chapter are set aside as sidebars, with their own heading.


© 1997, QUE Corporation, an imprint of Macmillan Publishing USA, a Simon and Schuster Company.