Results 1 to 3 of 3

Thread: Displaying Sorted Dataview

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2000
    Location
    Tennessee
    Posts
    279

    Question Displaying Sorted Dataview

    I want to sort a dataset and print the results. Reading the forums I deduced that I need to create a dataview and sort it that way. However, when I try to display the results it is not sorted. Here is an example:

    Dim dv As New DataView(SelectedRowsDS.Tables(0))

    dv.Sort = "transnum ASC"

    MsgBox(dv.Table.Rows(0).Item(5) & Chr(13) & _
    dv.Table.Rows(1).Item(5) & Chr(13) & _
    dv.Table.Rows(2).Item(5) & Chr(13) & _
    dv.Table.Rows(3).Item(5))


    In my example they are still sorted descending. Any help would be appreciated.
    A cynic knows the price of everything but the value of nothing.

  2. #2
    Addicted Member Dmyze's Avatar
    Join Date
    Mar 2002
    Location
    Seattle
    Posts
    160
    By Using dv.Table you are accessing the Unsorted table. use:

    dv(0)("")
    dv(0).Item(5)


    Like so:

    MsgBox(dv(0).Item(5) & Chr(13) & _
    dv(1).Item(5) & Chr(13) & _
    dv(2).Item(5) & Chr(13) & _
    dv(3).Item(5))
    -Daryl
    "Two More Rolls of Duct tape, and the world is mine!"
    VB.NET Guru

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2000
    Location
    Tennessee
    Posts
    279
    Aaahhhhh...Many Thanks!
    A cynic knows the price of everything but the value of nothing.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width