get value of Checkbox in datagrid
- by Himadri
I am working with windows application.
I have a datagrid in vb.net. Its first column is a checkbox. I want to know which checkboxes are checked and which are not.
My code is :  
         Dim dr As DataGridViewRow
            For i = 0 To gdStudInfo.RowCount - 1
                dr = gdStudInfo.Rows(i)
                att = dr.Cells(0).Value.ToString()
                If att.Equals("Present") Then
                    qry = "insert into Stu_Att_Detail values(" & id & "," & gdStudInfo.Rows(i).Cells(1).Value.ToString() & ",'" & dr.Cells(0).Value.ToString() & "')"
                    con.MyQuery(qry)
                End If
            Next  
I am getting correct values for all checked check box, but it gets error when the checkbox is not checked.