In this exercise, you experiment with passing variables by value and by reference. Open the VB2015Chap07Passing SolutionPassing

Question:

In this exercise, you experiment with passing variables by value and by reference. Open the VB2015\Chap07\Passing Solution\Passing Solution (Passing Solution.sln) file.

a. Open the Code Editor window and review the existing code. Notice that the strMyName variable is passed by value to the GetName procedure. Start the application. Click the Display Name button. When prompted to enter a name, type your name and press Enter. Explain why the btnDisplay_Click procedure does not display your name in the lblName control. Stop the application.

b. Modify the btnDisplay_Click procedure so that it passes the strMyName variable by reference to the GetName procedure. Save the solution and then start the application. Click the Display Name button. When prompted to enter a name, type your name and press Enter. This time, your name appears in the lblName control. Explain why the btnDisplay_Click procedure now works correctly.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: