We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

using GridRangeInfo.GetNextCell(...)

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 { // 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? Sam

1 Reply

AD Administrator Syncfusion Team March 11, 2004 08:39 AM UTC

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...

Loader.
Live Chat Icon For mobile
Up arrow icon