ListView Column Sorting
Category:Forms and Controls
If you want to add user sorting to your list views when in report mode, ie the user clicks a column header and the listview is sorted appropriatley, you may find this routine of use. In the ColumnClick event of a listview, call the routine using the list view object and the passed column header object. The routine will then detect if this column is the current sort column. If it is, then the sort order is reversed, either from Ascending to Desceding, or vice versa. If the clicked column is not the current sort, then the routine will sort the listview using this column in ascending order.
Instructions: Copy the declarations and code below and paste directly into your VB project.