Hello guys am working on a window application in vb.net Am trying to code an array that can add only 8 best subjects grades from the 10 subjects done by a student. the ten subject grades are displayed as labels and also the TOTAL of best eight subject grades is displayed as a label. Any one to help me. am new in programming. Here is my code.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' subject grades
Label1.Text = 7
Label2.Text = 1
Label3.Text = 3
Label4.Text = 8
Label5.Text = 4
Label6.Text = 9
Label7.Text = 2
Label8.Text = 5
Label9.Text = 2
Label10.Text = 6
Dim gradeList As New ArrayList()
gradeList.Add(Label1.Text)
gradeList.Add(Label2.Text)
gradeList.Add(Label3.Text)
gradeList.Add(Label4.Text)
gradeList.Add(Label5.Text)
gradeList.Add(Label6.Text)
gradeList.Add(Label7.Text)
gradeList.Add(Label8.Text)
gradeList.Add(Label9.Text)
gradeList.Add(Label10.Text)
'sort grades in an arraylist
gradeList.Sort()
' Please guys help me and modify this code to sort and SUM UP ONLY best eight done subject grades.
' I want label11.text to display the answer
'THANKS.
End Sub`