CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2001
    Posts
    126

    How to get back the default sort in listview

    I followed the MS code for sorting using your own method by setting a listview sorter property to my own compare class
    (*** listView1.ListViewItemSorter = new MyComparer(e.Column); ***)
    but I need it to go back to the default one in certain situations. How do I get back to the default?
    (*** listView1.ListViewItemSorter = <default???> ***)
    I made my own to sort the same way it does by default, but it runs much slower. Thanks.

  2. #2
    Join Date
    Oct 2002
    Location
    Växjö, Sweden
    Posts
    225
    Have not tried it myself but an idea that came to mind was:

    Create an own ListViewItem Class where you inherit from the original class and then create an index property for the new class. Set this property to an index for every item added to the ListView and then sort the ListView on the index property.

    /Leyan

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

Featured