Private Sub btnAssign_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAssign.Click
' declare constants and variables
Const strMSG As String = "Enter score: "
Dim intTotalPoints As Integer
Dim intScore As Integer
Dim strInputScore As String
Dim strLetterGrade As String
' use an input box box to fetch input for the three test scores
For intCount As Integer = 1 To 3
strInputScore = InputBox(strMSG, "Grade Calculator")
Integer.TryParse(strInputScore, intScore)
intTotalPoints += intScore
Next intCount
' use the total score to assign a grade
Select Case intTotalPoints
Case 270 To 300
strLetterGrade = "A"
Case 240 To 269
strLetterGrade = "B"
Case 210 To 239
strLetterGrade = "C"
Case 180 To 209
strLetterGrade = "D"
Case 0 To 180
strLetterGrade = "F"
Case Else
MessageBox.Show("Invalid point total", "Invalid Grade Alert", _
MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End Select
' output the total points and the letter grade
lblTotalPoints.Text = intTotalPoints.ToString
lblGrade.Text = strLetterGrade
End Sub