I need help for this problem and i have no idea on how to solve this.
This is the code;
Private Sub GetLabandOtherFees()
        Dim dic As New Dictionary(Of String, Integer)()
        Dim cellValue As String = Nothing
        For i As Integer = 0 To dgvSubjectsEnrolled.Rows.Count - 1
            If Not dgvSubjectsEnrolled.Rows(i).IsNewRow Then
                cellValue = dgvSubjectsEnrolled(0, i).Value.ToString()
                If Not dic.ContainsKey(cellValue) Then
                    dic.Add(cellValue, 1)
                Else
                    dic(cellValue) += 1
                End If
            End If
        Next
        Dim sb As New StringBuilder()
        For Each keyvalue As KeyValuePair(Of String, Integer) In dic
            sb.AppendLine(String.Format("{0}", keyvalue.Key, keyvalue.Value))
        Next
        For Each row As DataGridViewRow In dgvsub.Rows
            row.Cells(0).Value = sb.ToString()
            row.Cells(1).Value = dic.Count.ToString()
        Next
    End Sub
And this is the error;
"Object Reference Not set to an instance of an object." 
Check to determine if object is null before calling the method.
This error is putting headache on me. please help.
 
    