'Author: Eric Heim 'Class: CS0004 Option Strict On Option Explicit On Public Class frmMain 'If the letter grade radio button is checked, then clear the text boxes, enable the letter grade text box and disable the score text box Private Sub rbtLetterGrade_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtLetterGrade.CheckedChanged If rbtLetterGrade.Checked Then txtScore.Text = "" txtLetterGrade.Text = "" txtLetterGrade.Enabled = True txtScore.Enabled = False End If End Sub 'If the score radio button is checked, then clear the text boxes, enable the score text box and disable the lett grade text box Private Sub rbtScore_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtScore.CheckedChanged If rbtScore.Checked Then txtLetterGrade.Text = "" txtScore.Text = "" txtScore.Enabled = True txtLetterGrade.Enabled = False End If End Sub 'OK button click event Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click 'If the letter grade radio button is checked, then switch on the input on the letter grade text box If rbtLetterGrade.Checked Then Select Case txtLetterGrade.Text Case "A", "a" txtScore.Text = "90+" Case "B", "b" txtScore.Text = "89-80" Case "C", "c" txtScore.Text = "79-70" Case "D", "d" txtScore.Text = "69-60" Case "F", "f" txtScore.Text = "59 or below" Case Else MessageBox.Show("Invalid Letter Grade", "Invalid Letter Grade") End Select 'If the score radio button is checked, then switch on the input on the score text box Else 'If the input for the score text box is not numeric then produce an error If Not IsNumeric(txtScore.Text) Then MessageBox.Show("The Score Must Be a Number", "The Score Must Be a Number") Else Select Case CDbl(txtScore.Text) Case 90 To 100 txtLetterGrade.Text = "A" Case 80 To 89 txtLetterGrade.Text = "B" Case 70 To 79 txtLetterGrade.Text = "C" Case 60 To 69 txtLetterGrade.Text = "D" Case 0 To 59 txtLetterGrade.Text = "F" Case Else MessageBox.Show("Number Out of Valid Range", "Number Out of Valid Range") End Select End If End If End Sub End Class