VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Proper Listview Sorting

by PlanetBoogie (2 Submissions)
Category: VB function enhancement
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (9 Votes)

- 02/18/08 - updated to the final version of RDE's Pretty Sort (linked below) as well as to use the new StrCompFileNames function.
- 11/08/06 - updated to fix the issue Manuel noted dealing with the code not correctly sorting based on Column order.
- 10/25/06 - I completely rewrote the module after discovering several bugs in the Listview control - plus it is now more than twice as fast! This is as close to a drop-in solution as I can make it - with no known side effects.
The project uses Rde's Pretty File Names - Final 4 (https://www.VBCode.com/vb/scripts/ShowCode.asp?txtCodeId=63893&lngWId=1) and subclassing to properly sort alphanumeric columns in a listview.
Native sorting, and all other sorting techniques tried, will return:
Item (1)
Item (10)
Item (2)
...
Item (9)
But this module correctly sorts the list as:
Item (1)
Item (2)
...
Item (9)
Item (10)
The module also has examples on how to correctly sort numbers and dates. Sorry but it isn't documented - won't make bones about it, just don't have time but it is suprisingly short and fairly easy to read.
After days of searching, as far as I know this is the ONLY solution available to correctly sort a listview. Give it a try and please report any issues found.

Rate Proper Listview Sorting

Download Proper Listview Sorting

Download Proper Listview Sorting (15 KB)

Proper Listview Sorting Comments

No comments have been posted about Proper Listview Sorting. Why not be the first to post a comment about Proper Listview Sorting.

Post your comment

Subject:
Message:
0/1000 characters