We are currently doing a student monitoring attendance , and we want to count the total number of days each student is present and absent .
Subject LN FN MI 05/21/14 05/20/14 05/21/14 05/22/14 05/23/14 P A
Comp101 Yu Erick C (checked|(unchecked)|(checked)|(checked)|(checked)|4 | 1
"This is what we wanted to do but instead of counting horizontally it counts vertically.Is there anyone who can help us solving this problem?
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Present As Integer = 0
Dim Absent As Integer = 0
For a = 0 To DataGridView1.RowCount - 1
For b = 0 To DataGridView1.ColumnCount - 8
If DataGridView1.Rows(a).Cells(b + 5).Value = True Then
Present += 1
Else
Absent += 1
End If
Next
DataGridView1.Rows(a).Cells(10).Value = Present
DataGridView1.Rows(a).Cells(11).Value = Absent
Present = 0
Absent = 0
Next
End Sub
Try This ....