19.12.2012 Views

Computer Programming Concepts and Visual Basic David I. Schneider

Computer Programming Concepts and Visual Basic David I. Schneider

Computer Programming Concepts and Visual Basic David I. Schneider

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

26. Click the Save button when you are ready to go on. (Alternatively, press Tab<br />

several times until the Save button is highlighted <strong>and</strong> then press Enter.) The<br />

Save Project As dialog box appears.<br />

27. Type a file name into the File name box. You can use the same name, such as<br />

testprog, as before. Then proceed as in Steps 25 <strong>and</strong> 26. (The extension .vbp<br />

will be added.)<br />

28. Press Alt/F/N to begin a new program. (As before, select St<strong>and</strong>ard EXE.)<br />

29. Place three text boxes on the form. (Move each text box out of the center of the<br />

form before creating the next.) Notice that they have the names Text1, Text2,<br />

<strong>and</strong> Text3.<br />

30. Run the program. Notice that the cursor is in Text1. We say that Text1 has the<br />

focus. (This means that Text1 is the currently selected object <strong>and</strong> any keyboard<br />

actions will be sent directly to this object.) Any text typed will display in that<br />

text box.<br />

31. Press Tab once. Now, Text2 has the focus. When you type, the characters appear<br />

in Text2.<br />

32. Press Tab several times <strong>and</strong> then press Shift+Tab a few times. With Tab, the<br />

focus cycles through the objects on the form in the order the objects were created.<br />

With Shift+Tab, the focus cycles in the reverse order.<br />

33. End the program.<br />

34. Press Alt/F/O, or click on the Open Project icon to reload your first program.<br />

When a dialog box asks if you want to save your changes, click the No<br />

button or press N. An Open Project dialog box appears on the screen. Click on<br />

the Recent tab to see a list of the programs most recently opened or saved. Your<br />

first program <strong>and</strong> its location should appear at the top of the list. (Note: You can<br />

also find any program by clicking on the Existing tab <strong>and</strong> using the dialog box<br />

to search for the program.)<br />

35. Click on the name of your first program <strong>and</strong> then click on the Open button.<br />

Alternatively, double-click on the name. (You also have the option of typing the<br />

name into the File Name box <strong>and</strong> then clicking the Open button.)<br />

A COMMAND BUTTON WALKTHROUGH<br />

1. Press Alt/F/N <strong>and</strong> double-click on St<strong>and</strong>ard EXE to start a new program. There<br />

is no need to save anything.<br />

2. Double-click on the comm<strong>and</strong> button icon to place a comm<strong>and</strong> button in the<br />

center of the form. (The rectangular-shaped comm<strong>and</strong> button icon is the sixth<br />

icon in the Toolbox.)<br />

3. Activate the Properties window, highlight the Caption property, <strong>and</strong> type<br />

“Please Push Me”. See Figure 2-9. Notice that the letters appear on the comm<strong>and</strong><br />

button as they are typed. The button is too small.<br />

FIGURE 2-9 Setting the Caption Property<br />

<strong>Visual</strong> <strong>Basic</strong> Objects 23

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!