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.

24 <strong>Computer</strong> <strong>Programming</strong> <strong>Concepts</strong> <strong>and</strong> <strong>Visual</strong> <strong>Basic</strong><br />

4. Click on the comm<strong>and</strong> button to select it, <strong>and</strong> then enlarge it to accommodate<br />

the phrase “Please Push Me” on one line.<br />

5. Run the program, <strong>and</strong> click on the comm<strong>and</strong> button. The comm<strong>and</strong> button<br />

appears to move in <strong>and</strong> then out. In Section 2.2, we write code that is activated<br />

when a comm<strong>and</strong> button is pushed.<br />

6. End the program, <strong>and</strong> select the comm<strong>and</strong> button.<br />

7. From the Properties window, edit the Caption setting by inserting an ampers<strong>and</strong><br />

(&) before the first letter, P. Notice that the ampers<strong>and</strong> does not show on the<br />

button. However, the letter following the ampers<strong>and</strong> is now underlined. See Figure<br />

2-10. Pressing Alt+P while the program is running executes the same code<br />

as clicking the comm<strong>and</strong> button. Here, P is referred to as the access key for the<br />

comm<strong>and</strong> button. (The access key is always specified by the character following<br />

the ampers<strong>and</strong>.)<br />

FIGURE 2-10 Designating P as an Access Key<br />

A LABEL 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 label icon to place a label in the center of the form. (The<br />

label icon, a large letter A, is the third icon in the Toolbox.)<br />

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

Your Phone Number”. Such a label would be placed next to a text box into<br />

which the user will enter a phone number.<br />

4. Click on the label to select it, <strong>and</strong> then widen it until all words are on the same<br />

line.<br />

5. Make the label narrower until the words occupy two lines.<br />

6. Activate the Properties window, <strong>and</strong> double-click on the Alignment property.<br />

Double-click two more times <strong>and</strong> observe the label’s appearance. The combination<br />

of sizing <strong>and</strong> alignment permits you to design a label easily.<br />

7. Run the program. Nothing happens, even if you click on the label. Labels just<br />

sit there. The user cannot change what a label displays unless you write code to<br />

allow the change.<br />

8. End the program.<br />

A PICTURE BOX 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.

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

Saved successfully!

Ooh no, something went wrong!