So in this program I am writing, I am writing a function that takes the average I have already calculated for each student,(StudentAvg1, StudentAvg2, etc..) assigning a letter grade to their average, then displaying in a list box. The grades are as follows:
90-100 A
80-89 B
70-79 C
60-69 D
0-59 F
This is my code so far, keep in mind that I am VERY new to VB
/> :
But this is only for one Student(StudentAvg1), how do code it so I can use all of the students (5 to be exact), and assign them letter grades? I have tried commas, and the AND property, but I am stumped! Thank you for any advice!
90-100 A
80-89 B
70-79 C
60-69 D
0-59 F
This is my code so far, keep in mind that I am VERY new to VB
Private Function AssignGrade() As String
If StudentAvg1 > 0 Then
Select Case StudentAvg1
Case 90 To 99
Return ("A")
Case 80 To 89
Return ("B")
Case 70 To 79
Return ("C")
Case 60 To 69
Return ("D")
Case 0 To 59
Return ("F")
End Select
Else
MessageBox.Show("Error!")
End If
Private Sub btnAverage_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAverage.Click
lstDisplay.Items.Add(AssignGrade())
But this is only for one Student(StudentAvg1), how do code it so I can use all of the students (5 to be exact), and assign them letter grades? I have tried commas, and the AND property, but I am stumped! Thank you for any advice!