checkCell = CType(DataGridView1.Rows.Item(i).Cells(0), DataGridViewCheckBoxCell)
isChecked = CType(checkCell.Value, [Boolean])
If isChecked = True Then
int1=
int2=
......
end if
5.80 How can I get a CheckBox column in a DataGrid to react to the first click?
http://www.syncfusion.com/FAQ/WindowsForms/FAQ_c44c.aspx#q945q
[VB.Net}
Private myCheckBoxCol As Integer = 9 'my checkbox column
Private Sub DataGrid2_MouseUp(ByVal sender As Object, ByVal e As MouseEventArgs) Handles DataGrid2.MouseUp
Dim hti As DataGrid.HitTestInfo = Me.dataGrid2.HitTest(e.X, e.Y)
Try
If hti.Type = DataGrid.HitTestType.Cell AndAlso hti.Column = myCheckBoxCol Then
Me.dataGrid2(hti.Row, hti.Column) = Not CBool(Me.dataGrid2(hti.Row, hti.Column))
End If
Catch ex As Exception
MessageBox.Show(ex.ToString())
End Try
End Sub 'dataGrid2_MouseUp
其他参考:
5.33 How do I get the row and column of the current cell in my datagrid?
http://www.syncfusion.com/FAQ/WindowsForms/FAQ_c44c.aspx#q788q
5.27 How can I get the selected text in an active gridcell?
http://www.syncfusion.com/FAQ/WindowsForms/FAQ_c44c.aspx#q827q
5.15 How can I put a checkbox in a column of my DataGrid?
http://www.syncfusion.com/FAQ/WindowsForms/FAQ_c44c.aspx#q754q