Iterating through Datagridview

  • Thread starter Thread starter john pp nn
  • Start date Start date
J

john pp nn

Guest
Hi folks,

I have a datagridview where all the rows (around 200) have been selected (I have clicked on the upper left corner).

I then want to process each row so I use :


foreach (DataGridViewRow r in d.SelectedRows)
{
// do stuff...

d.Rows.Remove(r)
}



The trouble is that it process them from the bottom of the grid first and works its way up the top.

Ideally, I would like the for each loop to start at the top of the datagridview. I am removing the each row after I have processed it but it takes a while before it gets up to the topmost rows and looks like nothing is happening.

J


jppnn

Continue reading...
 
Back
Top