Private Sub btnCalcAverage_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles btnCalcAverage.Click ' This procedure gets the test scores, then calculates and ' displays the average. Dim sngTotal As Single ' Holds the running total of test scores Dim intNumScores As Integer ' The number of test scores Dim sngAverage As Single ' The average of the test scores Dim strInput As String ' To hold user input Dim intCount As Integer ' Counter variable for the loop ' Get the number of test scores. strInput = InputBox("How many test scores do you want " & _ "to average?", "Enter a Value") intNumScores = CInt(strInput) ' Store the starting values in total and count. sngTotal = 0 intCount = 1 ' Get the test scores. Do Until intCount > intNumScores strInput = InputBox("Enter the value for test score " _ & intCount.ToString, "Test Score Needed") sngTotal += CSng(strInput) intCount += 1 Loop ' Calculate and display the average. If intNumScores > 0 Then sngAverage = sngTotal / intNumScores Else sngAverage = 0.0 End If lblAverage.Text = sngAverage.ToString End Sub