For i As Int32 = 0 To Grid1.DataRows.Count – 1 Grid1.DataRows(i).Cells(5).Value = i ‘<<<<<<< if i = 0 the DataRows(0) isn’t the first row that I see in the grid(0.99 – ex 3)!? It’s always index of old record 0 (that now i see in the second row (index = 1)! Next
Imported from legacy forums. Posted by AndreaZ (had 163 views)
If I understand you correctly, you have a mechanism to reorder the DataRows by sorting on a (hidden?) column.
You can’t use the <b>Index</b> property of the DataRow, because that’s not the visible index: it never changes. Try this:<code>Grid1.BeginInit() Dim rows As Xceed.Grid.Collections.ReadOnlyDataRowList = Grid1.<b>GetSortedDataRows</b>(True) <i>’ rows is a list of the sorted DataRows</i> For i As Int32 = 0 To rows.Count – 1 rows.Item(i).Cells(5).Value = i Next Grid1.EndInit()</code>
Imported from legacy forums. Posted by Tommy (had 3447 views)