Learn Visual Basic in 24 hours
Hour 1 Visual Basic at Work
Hour 2 Analyzing Visual Basic Programs
Hour 3 Controls and Properties
Hour 4 Examining Labels, Buttons, and Text Boxes
Hour 5 Putting Code into Visual Basic
Hour 6 Improving Code: Message and Input Boxes
Hour 7 Making Decisions
Hour 8 Visual Basic Looping
Hour 9 Combining Code and Controls
Hour 10 List Boxes and Data Lists
Hour 11 Additional Controls
Hour 12 Dialog Box Basics
Hour 13 Modular Programming
Hour 14 Built-in Functions Save Time
Hour 15 Visual Basic Database Basics
Hour 16 Printing with Visual Basic
Hour 1 Visual Basic at Work
; Visual Basic at Work
; Whats Visual Basic About?
; Visual Basics Three Editions
; The VB Programming Process
; Starting Visual Basic
o Figure 1.1.
o Figure 1.2.
; Stopping Visual Basic
; Mastering the Development Environment
o Figure 1.3.
; Standards: The Menu Bar and Toolbar
o The Form Window: Where It All Happens
; Figure 1.4.
; Figure 1.5.
o The Toolbox Supplies Controls
; Figure 1.6.
o The Form Layout Window Places Forms
o The Project Explorer Window
; Figure 1.7.
o The Properties Window
; Help Is at Your Fingertips
Visual Basic at Work Welcome to Visual Basic! You possess one of the most powerful and enjoyable
Windows development tools available today. Visual Basic really is fun, as you'll see
throughout this 24-hour tutorial. In this hour you will become familiar with the big
picture of Visual Basic 5. The highlights of this hour include
; What Visual Basic does
; How to start Visual Basic
; How to stop Visual Basic
; When to use the different Visual Basic windows
; How the system windows work together for you
Whats Visual Basic About?
Controls are tools on the Toolbox window that you place on a form to interact with the user and control the program flow.
Microsoft Visual Basic 5.0, the latest and greatest incarnation of the old BASIC language, gives you a complete Windows application development system in one package. Visual Basic (or VB, as we often call it) lets you write, edit, and test Windows applications. In addition, VB includes tools you can use to write and compile help files, ActiveX controls, and even Internet applications. New Term: A program is a set of instructions that make the computer do something such as perform accounting. (The term program is often used synonymously with application.)
Visual Basic is itself a Windows application. You load and execute the VB system just as you do other Windows programs. You will use this running VB program to create other programs. VB is just a tool, albeit an extremely powerful tool, that programmers (people who write programs) use to write, test, and run Windows applications.
New Term: A project is a collection of files you create that comprises your Windows application.
Although programmers often use the terms program and application interchangeably (as will be done throughout this 24-hour course), the term application seems to fit the best when you're describing a Windows program because a Windows program typically consists of several files. These files work together in the form of a project. The project generates the final program that the user loads and runs from Windows by double-clicking an icon or by starting the application with the Windows Start menu. New Term: An application is a collection of one or more files that compile into an executable program.
The role of programming tools has evolved over the past 45 years along with hardware. A programming language today, such as Visual Basic, differs greatly from programming languages of just a few years ago. The visual nature of the Windows operating system requires more advanced tools than were available a few years ago. Before windowed environments, a programming language was a simple text-based with which you wrote programs. Today you need much more than just a language; need a graphical development tool that can work inside the Windows system and applications that take advantage of all the graphical, multimedia, online, and multiprocessed activities that Windows offers. Visual Basic is such a tool. More than language, Visual Basic lets you generate applications that interact with every aspect today's Windows operating systems.
NOTE: Although Visual Basic is a comprehensive programming tool, VB retains its BASIC language heritage. Designers in the late 1950s developed the BASIC programming language for beginning programmers. BASIC was easier to use than other programming languages of the time, such as COBOL and FORTRAN. never forgot VB's roots when developing Visual Basic. Newcomers to programming can learn to create simple but working Windows programs in just a short time. You be using Visual Basic to write Windows programs before the next hour is complete.
New Term: Wizards are question-and-answer dialog boxes that automate tasks.
New Term: A compiler is a system that converts the program you write into a computer-executable application.
If you've taken a look at Visual Basic in the past, you'll be amazed at today's Visual Basic system. VB now sports a true compiler that creates standalone that execute more quickly than previous VB programs. VB also includes several wizards that offer step-by-step dialog box questions that guide you through the of applications. VB's development platform, a development environment called the
Developer Studio, now supports the same features as the advanced Visual C++ and Visual J++ compilers. Therefore, once you learn one of Microsoft's Visual programming products, you will have the skills to use the other language products without a long learning curve ahead of you.
New Term:The Developer Studio is Visual Basic's development environment.
Programming languages today are not what they used to be. The language itself has not gotten less important; rather, the graphical interfaces to applications have gotten more important.
A computer cannot understand any person's spoken language. A spoken language, such as Italian or English, is simply too general and ambiguous for computers to understand. Therefore, we must adapt to the machine and learn a language that the computer can understand. VB's programming language is fairly simple and uses common English words and phrases for the most part. The language is not ambiguous, however. When you write a statement in the Visual Basic language, the statement never has multiple meanings within the same context.
New Term: Code is another name for the programming statements you write.
As you progress through the next 24 hours, you will learn more and more of the Visual Basic language's vocabulary and syntax (grammar, punctuation, and spelling rules). You will use the VB programming language to embed instructions within applications you create. All the code you write (code is the program's instructions) must work together to instruct the computer. Code is the glue that ties all the graphics, text, and processes together within an application. Code tells a checkbook application, for example, how to be a checkbook application and not something else. The program code lets the application know what to do given a wide variety of possible outcomes and user actions.
Visual Basics Three Editions
Visual Basic 5 comes in three flavors: the Standard Edition, the Professional Edition, and the Enterprise Edition. Although this book primarily deals with the Professional Edition, the Standard Edition is called the learning edition and provides the least expensive approach to using Visual Basic. The Standard Edition gives you a complete development environment, programming language, and many of the same tools the
other editions offer. If you use the Standard Edition, you have a powerful tool. Some people develop only with the Standard Edition and never need anything Although this course targets the Professional Edition in an attempt to hit common ground, you will be able to utilize virtually the entire 24-hour course if you use the Standard Edition; you will find additional tools in the Standard Edition that this does not even get to.
The Professional Edition offers a few more tools, including extra ActiveX add-in tools, better Internet programming support, a help file compiler, and improved database access tools. Most professional programmers use the Professional Edition. The Enterprise Edition provides the client/server programmer with extended tools for remote computing and application distribution. Microsoft enhanced VB's performance for Enterprise Edition users working in a networked, distributed environment.
TIP:Most programmers need only the Standard or Professional Edition. The Enterprise Edition is aimed at developers who write network-intensive client/server applications. The Enterprise Edition is enhanced to aid such programmers who work within the special client/server environments.
If you want to create your own ActiveX controls, you will need the VB 5 Custom Control Edition that comes with the Professional and Enterprise Editions. If you use the Standard Edition, you're still in luck because the CD-ROM that comes with this book includes the VB 5 Custom Control Edition, which you can add to your Visual Basic folder and use to create ActiveX controls. Hour 21, "Visual Basic and ActiveX," describes more about the VB 5 Custom Control Edition.
The VB Programming Process
When you want to use Visual Basic, you'll follow these basic steps:
1. Start Visual Basic.
2. Create a new application or load an existing application. When you create a
new application, you might want to use Visual Basic's VB Application Wizard
to write your program's initial shell, as you'll do in the next hour.