Clearly Visual Basic, 3rd Edition Programming with Microsoft Visual Basic 2012 b
ID: 3828963 • Letter: C
Question
Clearly Visual Basic, 3rd Edition
Programming with Microsoft Visual Basic 2012
by Diane Zak
Year: 2013
Pages: 674
ISBN: 978-1285084107, 1285084101
Part 1—Chapter 13: Complete Exercise 3 (Modify This) on page 302. Complete Exercise 5 (Introductory) on page 302. Part 2—Chapter 14: Complete Exercise 2 (Try This) on page 322. Complete Exercise 11 (Intermediate) on pages 325- 326.
In this exercise, you modify the Bouncing Robot application coded in the chapter. Use Windows to make a copy of the Robot Solution folder. Save the copy in the ClearlyVB2012Chap13 folder. Rename the copy Modified Robot Solution. Open the Robot Solution (Robot Solution.sln) file contained in the Modified Robot Solution folder. Open the designer and Code Editor windows. Currently, the pretest loop in the btnPretest_Click procedure starts counting at 0 and stops when it reaches the number of bounces entered by the user. Modify the code so that it starts counting with the number of bounces entered by the user and stops when it reaches 0. Save the solution and then start the application. Test the Pretest Loop button’s code. Close the Code Editor window and then close the solution.
Explanation / Answer
Okay, as the file is not provided so I'm telling you how to replace the loop so that it starts counting with the number of bounces entered by user and stops when it reaches 0.
Suppose n holds the number of bounces value entered by user.
In Subroutine btnPretest_Click()
Dim i As Integer
For i = n To 0 Step -1
'Body of the loop
Next i
Here, Step -1 tells VB that the iteration variable should get added to -1. If Step is not defined, then the default value is 1.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.