The ListView_Sort() function sorts the items in a list view field.
ListView_Sort(list_view_field {, sort_method})
• list_view_field – The list view field that is being sorted.
• sort_method – An optional integer parameter that specifies the sorting method to use. The value corresponds to one of the following constants:
Constant |
Description |
---|---|
LV_SORT_ASCENDING |
Items are sorted in ascending order based on the item label. |
LV_SORT_DESCENDING |
Items are sorted in descending order based on the item label. |
LV_SORT_COLUMN |
Items are sorted based on a column in the list. |
LV_SORT_NONE |
Items are not sorted. |
LV_SORT_DEFAULT |
Items are sorted using the method specified by the SortMethod property. |
If this parameter isn’t included, the list view field will be re-sorted based on the current sorting method.
A boolean indicating whether the list view field was sorted. True indicates the list view was sorted, while false indicates it was not.
Using the ListView_Sort() function to specify a sorting method will override the sorting method specified by the list view field’s SortMethod property.
When items are added to a list view field, they are added at the bottom of the list, regardless of how the list is currently being sorted. You can use the ListView_Sort() function after adding items to re-sort the list.