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?

This post may help.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.