Question: 6. In this exercise, you experiment with passing variables by value and by reference. Open the VB2015Chap07Passing SolutionPassing Solution (Passing Solution.sln) file. a. Open the

6. 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.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock