1. Create a new project in Visual Studio and name it LA_Activity_3.7
2. Enter the following code in the Load behavior of Form 1: My Code:
3. Run the project and enter the number 11 when the InputBox prompts you to enter a number.
The final message showed the number 11 because the value of intUserNumber was greater than ( > ) the value of intProgramNumber. This caused the If statement to execute, causing the value of intProgramNumber to be changed to the value of intUserNumber. The program then executed the final line of code which displayed the value of intProgramNumber.
4. Re-run the project and this time enter the number 9 when the InputBox prompts you to enter a number.
This time the final message showed the number 10 because the value of intUserNumber was not greater than the value of intProgramNumber. The If statement was not executed, so the value of intProgramNumber was not changed. The program simply skiped the If statement and executee the final line of code, displaying the value of intProgramNumber.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment