Let me tell you what we wanted to do, the user has to click every check box because it represents the number of the students attendance and once the user click the button 1 it will show the total number of days present and the button 2 is for the total absent of each students. but when we run our program it only count the number per column. so please help us . . thank you!
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If DataGridView1.RowCount > 1 Then
Dim counter As Integer = 0
Dim Counter1 As Integer = 0
Dim Counter2 As Integer = 0
Dim Counter3 As Integer = 0
Dim Counter4 As Integer = 0
Dim Counter5 As Integer = 0
Dim Counter6 As Integer = 0
Dim Counter7 As Integer = 0
Dim Counter8 As Integer = 0
Dim Counter9 As Integer = 0
Dim Counter10 As Integer = 0
For Each dr As DataGridViewRow In DataGridView1.Rows
If dr.Cells("checkColumn").Value = True Then
counter += 1
End If
If dr.Cells("checkCol1").Value = True Then
Counter1 += 1
End If
If dr.Cells("checkCol2").Value = True Then
Counter2 += 1
End If
If dr.Cells("checkCol3").Value = True Then
Counter3 += 1
End If
If dr.Cells("checkCol4").Value = True Then
Counter4 += 1
End If
If dr.Cells("checkCol5").Value = True Then
Counter5 += 1
End If
If dr.Cells("checkCol6").Value = True Then
Counter6 += 1
End If
If dr.Cells("checkCol7").Value = True Then
Counter7 += 1
End If
If dr.Cells("checkCol8").Value = True Then
Counter8 += 1
End If
If dr.Cells("checkCol9").Value = True Then
Counter9 += 1
End If
If dr.Cells("checkCol10").Value = True Then
Counter10 += 1
End If
Next
DataGridView1.Rows(0).Cells("Present").Value = counter
DataGridView1.Rows(1).Cells("Present").Value = Counter1
DataGridView1.Rows(2).Cells("Present").Value = Counter2
DataGridView1.Rows(3).Cells("Present").Value = Counter3
DataGridView1.Rows(4).Cells("Present").Value = Counter4
DataGridView1.Rows(5).Cells("Present").Value = Counter5
DataGridView1.Rows(6).Cells("Present").Value = Counter6
DataGridView1.Rows(7).Cells("Present").Value = Counter7
DataGridView1.Rows(8).Cells("Present").Value = Counter8
DataGridView1.Rows(9).Cells("Present").Value = Counter9
End If
End Sub