I'm trying to figure out some behavior in an app that I'm supporting. The snippet is:
foreach (DataGridViewRow pGridRow in grdEmail.Rows)
{
pGridRow.Cells[0].Value = chkSelectAll.Checked;
pCount = pGridRow.Index + 1;
}
Which is essentially trying to select all rows in a grid (check a box) when a select all checkbox is clicked.
When the grid has a few rows (hundred or so) it works beautifully. However, when I have around 5000 rows in it, this thing crawls. The pGridRow.Cells[0].Value = chkSelectAll.Checked
command takes a second or so (timed by putting Console.prints above and below it).
Any idea would be appreciated in resolving this.