Results 1 to 5 of 5

Thread: LVS_OWNERDATA and sorting

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    2,586

    LVS_OWNERDATA and sorting

    Has anyone ever implemented a sorting routine for virtual ListViews? Figured I'd ask before I went crazy reinventing the wheel; basic search didn't turn up anything. Trying to convert my shell browser to virtual mode... should be, well, interesting.

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Posts
    21,584

    Re: LVS_OWNERDATA and sorting

    It's just a question of sorting your backing data.

    I normally use an ADO Recordset to hold the data, which makes sorting pretty easy.

    See: https://www.vbforums.com/showthread....=1#post4827625

  3. #3
    PowerPoster
    Join Date
    Feb 2006
    Posts
    21,584

    Re: LVS_OWNERDATA and sorting

    I realize you probably aren't using a query rowset as backing storage, but you can always use a fabricated Recordset. No database is needed for ADO Recordsets.

  4. #4
    Addicted Member jj2007's Avatar
    Join Date
    Dec 2015
    Posts
    131

    Re: LVS_OWNERDATA and sorting

    The point about LVS_OWNERDATA is that you are absolutely free in the choice of how you manage your data. The control really doesn't care what you use for sorting - as discussed, btw, here in May 2018

    So pick a fast routine, from a C dll for example. I have a 100,000 records database from the post by dilettante mentioned above, it gets sorted in about 60-80ms on my trusty old Core i5. Excel needs more than a second, OpenOffice is another factor 10 slower. I've heard that Python offers really fast string sorts, maybe that's worth a test - if speed matters at all for you.

  5. #5
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,536

    Re: LVS_OWNERDATA and sorting

    The only project where I use virtual listview & sort, the data is not recordset-bound. In my case, the items are initially sorted when read from unsorted source. As suggested, use a fast sorting routine as needed or use sorted indexes. If recordset-bound, already suggested to use its sorting functions.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

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