Communicating between Arguments and Parameters


[Page 633]

The following walkthrough uses the Locals window to monitor the values of arguments and parameters during the execution of a program.

1.

If you have not already done so, type the preceding program into the Code window.

2.

Place the cursor on the line beginning "Private Sub," press the right mouse button, and click on "Run to Cursor." The program will execute, and the form will appear.

3.

Click on the button.

4.

Select the Debug menu, hover the cursor over "Windows," and then click on "Locals." Notice that the variables b and p from the btnPush_Click event procedure appear in the Locals window. The other variables in the list (Me, sender, and e) needn't concern us.

5.

Press F8 twice to point to the calling statement. Notice that the value of the variable p has changed.

6.

Press F8 to call the Sub procedure. Notice that the variables displayed in the Locals window are now those of the procedure GetBalance.

7.

Press F8 three times to execute the procedure.

8.

Press F8 to return to the btnPush_Click event procedure. Notice that the value of the variable b has inherited the value of the variable bal.

9.

Press Ctrl + Alt + Break to terminate debugging.




An Introduction to Programming Using Visual Basic 2005
Introduction to Programming Using Visual Basic 2005, An (6th Edition)
ISBN: 0130306541
EAN: 2147483647
Year: 2006
Pages: 164

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net