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

How are you storing the values for each student, that you want the averages of?

You have four button controls but you haven't told us what they do and you haven't even given them descriptive names. Instead, you dump the code here with almost no explanation and expect us to figure out what it is supposed to do. Put some effort into asking the question and we'll be happy to offer some suggestions.

and also try it to debug your codes.. to see the errors..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.