int rowCount = 0; foreach ( DataGridItem DemoGridItem in DemoGrid.Items ) { CheckBox myCheckbox = ( CheckBox ) DemoGridItem.Cells[0].Controls[1]; if ( myCheckbox.Checked == true ) { rowCount++; } }
int rowCount = 0; foreach (DataGridViewRow row in DemoGrid.Rows) { DataGridViewCheckBoxCell cell = row.Cells[colCheck] as DataGridViewCheckBoxCell; if ( cell!=null && !DBNull.Value.Equals( cell.Value ) && ( bool ) cell.Value == true ) { //Your code here } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)