We have a datagridview. Its multiselect property is set to true. This datagridview will update its rows in a particular interval time say one or two seconds.
So suppose i will select a row and then hold shift key and select another row, then the whole rows between these two is selected without any issue.
Suppose if i select a row and after that the gridview is updated, and then if i am trying to select another row by holding the shift key , then its not selecting the whole rows, instead the last clicked row is selected.
So i am not sure why its happening, so its like if i am selecting the 2nd row of the grid and updation may be this row is moved down say 5th row, and after that i am trying to select another row holding shift key, then this error is happening.
Anyone please give your suggestions on this issue.
code for selection after updation
for (int nRow = 0; nRow < Grid.Rows.Count; nRow++)
{
foreach (string cookieIdval in SelectedCookies)
{
if (Grid.Rows[nRow].Cells[ColCookieID].Value.ToString() == cookieIdval.ToString())
{
Grid.Rows[nRow].Cells[ColCookieID].Selected = true;
break;
}
}
}