i was try to solve it , but im begnner in vb.net
this is my code
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim x As New ListViewItem(t1.Text)
x.SubItems.Add(t2.Text)
x.SubItems.Add(t3.Text)
x.SubItems.Add(CInt(t2.Text) + CInt(t3.Text))
l1.Items.Add(x)
t1.Text = ""
t2.Text = ""
t3.Text = ""
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If l1.SelectedIndices.Count > 0 Then
For i As Integer = 0 To l1.SelectedIndices.Count - 1
l1.Items.RemoveAt(l1.SelectedIndices(0))
Next
End If
End Sub
Dim avg As Double
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim sum As Integer
For i As Integer = 0 To l1.Items.Count - 1
sum += l1.Items(i).SubItems(3).Text
Next
avg = sum / l1.Items.Count
t4.Text = avg
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
For i As Integer = 0 To l1.Items.Count - 1
If CDbl(l1.Items(i).SubItems(3).Text) >= CDbl(avg + 30) Then
l1.Items(i).SubItems(4).Text = "A+"
ElseIf CDbl(l1.Items(i).SubItems(3).Text) >= CDbl(avg + 25) Then
l1.Items(i).SubItems(4).Text = "A"
ElseIf CDbl(l1.Items(i).SubItems(3).Text) >= CDbl(avg + 20) Then
l1.Items(i).SubItems(4).Text = "A-"
ElseIf CDbl(l1.Items(i).SubItems(3).Text) >= CDbl(avg + 15) Then
l1.Items(i).SubItems(4).Text = "B+"
ElseIf CDbl(l1.Items(i).SubItems(3).Text) >= CDbl(avg + 10) Then
l1.Items(i).SubItems(4).Text = "B"
ElseIf CDbl(l1.Items(i).SubItems(3).Text) >= CDbl(avg + 5) Then
l1.Items(i).SubItems(4).Text = "B-"
ElseIf CDbl(l1.Items(i).SubItems(3).Text) >= CDbl(avg + 0) Then
l1.Items(i).SubItems(4).Text
ElseIf CDbl(l1.Items(i).SubItems(3).Text) >= CDbl(avg - 5) Then
l1.Items(i).SubItems(4).Text = "C"
ElseIf CDbl(l1.Items(i).SubItems(3).Text) >= CDbl(avg - 10) Then
l1.Items(i).SubItems(4).Text = "C-"
ElseIf CDbl(l1.Items(i).SubItems(3).Text) >= CDbl(avg - 15) Then
l1.Items(i).SubItems(4).Text = "D+"
ElseIf CDbl(l1.Items(i).SubItems(3).Text) >= CDbl(avg - 20) Then
l1.Items(i).SubItems(4).Text = "D"
ElseIf CDbl(l1.Items(i).SubItems(3).Text) < CDbl(avg - 20) Then
l1.Items(i).SubItems(4).Text = "F"
End If
Next
End Sub
End Class