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.

3. Click on the down arrow at the right of the Procedure box <strong>and</strong> then select a procedure.<br />

C. Create a general procedure.<br />

1. Access the Code window.<br />

2. Move to a blank line that is not inside a procedure.<br />

3. Type Private Sub (for a Sub procedure) or Private Function (for a Function procedure)<br />

followed by the name of the procedure <strong>and</strong> any parameters.<br />

4. Press the Enter key. (The Code window will now display the new procedure<br />

heading <strong>and</strong> an End Sub or End Function statement.)<br />

5. Type the procedure into the Code Window.<br />

or<br />

1. Access the Code window.<br />

2. Press Alt/T/P. (A dialog box will appear.)<br />

3. Type the name of the procedure into the Name rectangle.<br />

4. Select the type of procedure.<br />

5. Select the Scope by clicking on Public or Private. (In this book, we always use<br />

Private.)<br />

6. Press the Enter key. (The Code window will now display the new procedure<br />

heading <strong>and</strong> an End Sub or End Function statement.)<br />

7. Type the procedure into the Code Window.<br />

D. Alter a procedure.<br />

1. View the procedure in the Code Window as described in item B of this section.<br />

2. Make changes as needed.<br />

E. Remove a procedure.<br />

1. Bring the procedure into the Code Window as described in item B of this section.<br />

2. Mark the entire procedure as a block. That is,<br />

a. Press Ctrl+PgUp to move the cursor to the beginning of the procedure.<br />

b. Hold down the Shift key <strong>and</strong> press Ctrl+PgDn to move the cursor to the start<br />

of the next procedure.<br />

c. Press the Up Arrow key until just after the end of the procedure to be<br />

deleted.<br />

3. Press the Del key.<br />

F. Insert an existing procedure into a program.<br />

1. Open the program containing the procedure.<br />

2. View the procedure in the Code Window as described in item B of this section.<br />

3. Mark the entire procedure as a block, as described in step 2 of item E of this<br />

section.<br />

4. Press Ctrl+C to place the procedure into the clipboard.<br />

5. Open the program in which the procedure is to be inserted <strong>and</strong> access the Code<br />

Window.<br />

6. Move the cursor to a blank line.<br />

7. Press Ctrl+V to place the contents of the clipboard into the program.<br />

Appendix B 419

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

Saved successfully!

Ooh no, something went wrong!