Research the Visual Basic ReDim statement. What is the purpose of the statement? What is the purpose
Question:
Research the Visual Basic ReDim statement. What is the purpose of the statement? What is the purpose of the Preserve keyword?
a. Open the ReDim Solution.sln contained in the VB2017\Chap08\ReDim Solution folder. Open the Code Editor window and locate the array declaration statement in the form class’s declarations section. Start the application. Type 25 in the Sales box and then click the Add to array button. An error message box opens and informs you that the computer encountered an error when trying to process the TryParse method in the btnAdd_Click procedure. Stop the application.
b. Modify the btnAdd_Click procedure so that it can store any number of sales amounts in the array. (Hint: Use the ReDim statement to add an element to the array before the TryParse method is processed.)
c. Save the solution and then start the application. Type 25 in the Sales box and then press Enter. Click the Display array button . The sales amount appears in the list box.
d. Now, use the Add to array button to add the following sales amounts, one at a time: 700, 550, and 800. Click the Display array button. The four sales amounts appear in the list box.
Step by Step Answer: