I''m currently using beta 2 of Grid Control:
I have the following code:
foreach(GridRangeInfo range in _grid.Selections.Ranges)
int currentRow, currentCol;
range.GetFirstCell(out currentRow, out currentCol);
// do something with current cell value
while (range.GetNextCell(ref currentRow, ref currentCol) && currentCol <= _grid.Model.ColCount && currentRow <= _grid.Model.RowCount );
Now originally the while condition was simply while(range.GetNextCell(...) (no constraints on currentCol and currentRow). But when I selected a row or a column by clicking on the header, this piece of code would go into a seemingly infinite loop. So I had to add the constraints. But shouldn''t GetNextCell stop when it gets to the end of the row or column?
Is this a bug?
If you want to use range.GetFirstCell and range.GetNextCell to interate through a range, then the range must have RangeType Cells. You can get your code to work like this:
foreach(GridRangeInfo range1 in _grid.Selections.Ranges)
GridRangeInfo range = range1.ExpandRange(1, 1, _grid.RowCount, _grid.ColCount);
//..... continue with your code...