How to do multi-column sorting on a Visual Basic 6 ListView?
-
09-06-2019 - |
Question
I am working in Visual Basic 6 and need to sort by multiple columns in a ListView. For example, sorting a list of music tracks by artist, then album, then track number. As far as I know, VB6 does not support this out of the box. Here are the suggestions I have already heard:
- Sort the data in a SQL table first and display the data in the resulting order
- Sort the data in an ADO recordset object in memory
- Sort by the primary column and then perform a sort algorithm on the items, moving them around into the correct positions manually
Does anyone have experience with multiple-column sorting in VB6 who could lend advice?
Solution
I would create a hidden column in the listview that concatenates those three columns and sort by that
OTHER TIPS
You can try sorting using the Windows API and callbacks: Link
Alternatively, you could try switching to a vbAccelerator ListView; I highly recommend it.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow