Thursday, March 15, 2012

Test Grade


I have yet to figure out how Visual Basic reads things in a predictable manner. For example, when I placed the list below (of Select Case) in reverse order, the program would only show me "D" for any number greater than 60. I had to switch the order with "A" on top and "F" on the bottom for it to work:
Dim Grade As Double
        Grade = Val(Me.txtGrade.Text)
        Select Case Grade
            Case Is > 90
                Me.lblMessage.Text = "A"
            Case Is >= 80
                Me.lblMessage.Text = "B"
            Case Is >= 70
                Me.lblMessage.Text = "C"
            Case Is >= 60
                Me.lblMessage.Text = "D"
            Case Is < 60
                Me.lblMessage.Text = "F"
        End Select

No comments:

Post a Comment