Visual Basic in 12 Easy Lessons velp01.htm
Project
1
Welcome to Visual Basic!
Note: This first
project is slightly different from the other projects because although you have been exploring the Visual Basic environment, you have not yet written a program. Beginning with the second project, you will see how a complete
Visual Basic program
works.
Stop & Type
In this lesson, you learned about the history
of Visual Basic and the fundamentals its programming environment. Visual Basic is a programming system rich in tools. The five windows of the Visual Basic programming system operate in conjunction with one
other to give you the tools that you need to
create programs.
In this lesson, you saw the following:
- An introduction to programming
- A brief history of the BASIC language
- How programming for Windows differs greatly from programming for
text-based systems, such as DOS
- The kinds of programming errors that you can expect
- Why program errors appear and the steps that you take to correct them
- How to install the Visual Basic Primer disk that
comes with this book
- How to start Visual Basic
- The parts of the Visual Basic screen and environment, such as the five fundamental windows of the program
- The Visual Basic menus
- How to stop
Visual Basic
Step 1: Start Visual Basic
Before you write a Visual Basic program, you must start the Visual
Basic system. Follow these steps:
- Turn on your computer.
- Start Windows.
- Press Ctrl+Alt+V if you followed the shortcut startup from Unit 2. Otherwise, open the Visual Basic 2.0
program group and double-click the Visual Basic Primer icon. The Visual Basic programming environment appears.
Step 2: Practice Working with
Visual Basic
- Resize the Form window so that its lower edge reaches the bottom of your screen. Move the mouse cursor to the lower edge of the Form window until the mouse cursor becomes a two-headed arrow. Drag the
lower edge downward as far as you can and release
the mouse button.
- When you clicked the Form window's edge, the Form window probably hid the Project and Properties windows from view. Press Alt+W, R to bring the Project window into view.
By pressing Alt+W, R, you select the Window Project Window menu command.
- The Toolbox window is a window that you will use nearly as often as the Form window. You might not like the location of the toolbox, however. Sometimes when you
expand the Form window to the size of the entire screen, you will be placing items at the
left of the Form window, where the toolbox is now. Therefore, practice moving the Toolbox window.
Point the mouse cursor to the thin bar at the top of the
Toolbox window. This bar to the right of the control button is known as the title bar even though there is no title on the Toolbox window's title bar. Click and hold the mouse, and drag
the Toolbox window to the right side of the screen.
Step 3: Modify the Environment
- If you want to get rid of the toolbarthe bar of icon buttons directly
below the menu barpress Alt+V, T. The toolbar disappears to give you more screen room.
- Visual Basic enables you to turn off the grid dots on the Form window. Press Alt+O, E to select the Environment command from the Options menu.
Scroll to the bottom of the list of options by pressing the Page Down key. If you are familiar with scroll
bars, you can drag the scroll box down to its farthest point.
- Click the Show Grid option, which is the second one from the bottom.
Press N to change the option to No.
- Press Enter or click OK to see the results. The Form window no longer has grid dots.
- Feel optimistic with your Visual Basic skills? Reverse the changes that you made in this section.
Turn the toolbar and the grid dots back on.
Note: If you want to play more with Visual Basic's environment, go ahead. When you are finished, exit Visual Basic by pressing Alt+F, X. Visual Basic will notice that you've made
changes and will display a dialog box that asks whether you want to
make changes to the form. Select No to indicate that you do not want this project's changes to remain in effect and that you want to return to Program Manager. Always return to Program
Manager when you're finished with Visual Basic.