I can get the current selected row in this way:
private void DataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e){
//Cells[0] cause CheckBoxColumn is in that index (first column)
DataGridViewCheckBoxCell temp = (DataGridViewCheckBoxCell)dgv.Rows[e.RowIndex].Cells[0];
}
So, Now I want to get all of the rows that have been checked by the user:
foreach (var row_ in DataGridView1.Rows.OfType<DataGridViewRow>().
Select(o => o.Cells.OfType<DataGridViewCheckBoxCell>().
Where(r => r.Value.Equals(true))).FirstOrDefault()){
}
I am getting null reference
from the debugger.
What am I doing wrong?