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.

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

17. Press F5 to run the program. (Alternatively, a program can be run from the<br />

menu by pressing Alt/R/S or by clicking on the Start icon , the twelfth icon<br />

on the Toolbar.) Notice that the dots have disappeared from the form.<br />

18. The cursor is at the beginning of your name. Press the End key to move the cursor<br />

to the end of your name. Now type in your last name, <strong>and</strong> then keep typing.<br />

Eventually, the words will scroll to the left.<br />

19. Press Home to return to the beginning of the text. You have a full-fledged word<br />

processor at your disposal. You can place the cursor anywhere you like to add<br />

or delete text. You can drag the cursor across text to create a block, place a copy<br />

of the block in the clipboard with Ctrl+C, <strong>and</strong> then duplicate it anywhere with<br />

Ctrl+V.<br />

20. To terminate the program, press Alt+F4. Alternatively, you can end a program<br />

by clicking on the End icon , the fourteenth icon on the Toolbar, or clicking<br />

on the form’s close button .<br />

21. Select the text box, activate the Properties window, select the MultiLine property,<br />

click on the down-arrow button, <strong>and</strong> finally click on True. The MultiLine<br />

property has been changed from False to True.<br />

22. Run the program, <strong>and</strong> type in the text box. Notice that now words wrap around<br />

when the end of a line is reached. Also, text will scroll up when it reaches the<br />

bottom of the text box.<br />

23. End the program.<br />

24. Press Alt/F/V, or click on the Save Project icon to save the work done so far.<br />

A Save File As dialog box appears. See Figure 2-8. <strong>Visual</strong> <strong>Basic</strong> creates two<br />

disk files to store a program. The first, with the extension .frm, is entered into<br />

the Save File As dialog box <strong>and</strong> the second, with the extension .vbp, into a Save<br />

Project As dialog box. <strong>Visual</strong> <strong>Basic</strong> refers to programs as projects.<br />

FIGURE 2-8 The Save File As Dialog Box<br />

25. Type a file name, such as testprog into the “File name” box. The extension .frm<br />

automatically will be appended to the name. Do not press the Enter key yet.<br />

(Pressing the Enter key has the same effect as clicking Save.) The selection in<br />

the “Save in” box tells where your program will be saved. Alter it as desired.<br />

(Suggestion: If you are using a computer in a campus computer lab, you probably<br />

should use a diskette to save your work. If so, place the diskette in a drive,<br />

say, the A drive, <strong>and</strong> select 3 1/2 Floppy (A:) in the “Save in” box.)

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

Saved successfully!

Ooh no, something went wrong!