Home Forums WinForms controls Xceed Grid for WinForms CurrencyManager?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #13362 |

    Excuse my bad english :$

    my column(5):

    0
    1
    2
    3

    after changed (moved) 3

    0
    0.99 (ex 3)
    1
    2

    After an order by column(5) (order automatic by my DataTable) I want set the value of the cell(5) like the row.index.

    I can’t do it because the Row.index that I view in the grid isn’t the index of my record

    For i As Int32 = 0 To Grid1.DataRows.Count – 1
    Grid1.DataRows(i).Cells(5).Value = i ‘<<<<<<< if i = 1 the DataRows(i) isn’t the first row that I see in the grid!? It’s always index of record 2!
    Next

    I will need of the CurrencyManager?

    Code, plz 🙂

    bye

    Imported from legacy forums. Posted by AndreaZ (had 2550 views)

    User (Old forums)
    Member
    Post count: 23064

    PRECISING:

    If I change also the first record:

    0.99 (ex 3)
    0
    1
    2

    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

    Thanks!

    Imported from legacy forums. Posted by AndreaZ (had 163 views)

    User (Old forums)
    Member
    Post count: 23064

    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)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.