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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

using GridRangeInfo.GetNextCell(...)

Thread ID:





11601 Mar 11,2004 07:00 AM UTC Mar 11,2004 08:39 AM UTC WinForms 1
Tags: GridControl
Samuel Jack
Asked On March 11, 2004 07:00 AM UTC

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


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon

Live Chat Icon For mobile
Live Chat Icon