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.
Unfortunately, activation email could not send to your email. Please try again.

using GridRangeInfo.GetNextCell(...)

Thread ID:





11601 Mar 11,2004 02:00 AM Mar 11,2004 03:39 AM Windows Forms 1
Tags: GridControl
Samuel Jack
Asked On March 11, 2004 02:00 AM

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

Administrator [Syncfusion]
Replied On March 11, 2004 03:39 AM

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


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.