I am using a GridView control to display some data and I need to programatically change the values of the selected cells. When I iterate through the selected cells collection, it is sorted in the order which you selected the cells in. For example, the row indexes may be 1, 1, 1, 2, 2, 2, 1, 2, 1, 2. I want to edit all the cells with row index 1 before I move on to 2.
Share
If I understand you correctly, you want to iterate through the SelectedCells collection of a Windows Forms DataGridView in Row Index order.
I don’t have a real setup to test this right now, but you could try something like this:
You can then “foreach” over q
Cheers