Thursday, January 27, 2011

How to do multi-column sorting on a Visual Basic 6 ListView?

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?

  • You can try sorting using the Windows API and callbacks: Link

    Alternatively, you could try switching to a vbAccelerator ListView; I highly recommend it.

    From rpetrich
  • I would create a hidden column in the listview that concatenates those three columns and sort by that

    From DJ

0 comments:

Post a Comment