I don't know what i doing wrong. I have been on several forums trying to figure out how to sort a table in visual basic.
I have treid with and with out a dataview, but noting seams to work.

I have a logg that the user can do new inserts in. It has 3 columns. "Date", "Tool", "Comment".
When my VB application loads the program reads the table from a Access database and i get my sorting just fine by the sql phrase:

"select * from Logg ORDER BY Logg.Datum DESC"

After a user have uppdated the table i whant to sort it again. I have treid the following, but nothing happens. The order is the same whatever i do.

DS is my Dataset and dw my dataview, and "Datum" the column i whant to sort

        DS.Tables("hela").DefaultView.Sort = "Datum DESC"
        dw = DS.Tables("hela").DefaultView
        For i = 0 To antal_poss - 1
            LOGG(i, 0) = dw.Table.Rows(i).Item(3)
            LOGG(i, 1) = dw.Table.Rows(i).Item(1)
            LOGG(i, 2) = dw.Table.Rows(i).Item(4)
        Next i

What am i doing wrong?

2 Years
Discussion Span
Last Post by cgeier

This post may help.

If you want more help, please post more of your code--particularly the variable declarations.

Edited by cgeier

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.