The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
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
ADAdministrator 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...