ListView_Sort()

Examples


The ListView_Sort() function sorts the items in a list view field.

Syntax

ListView_Sort(list_view_field {, sort_method})

Parameters

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:

[spacer]

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.

Return value

A boolean indicating whether the list view field was sorted. True indicates the list view was sorted, while false indicates it was not.

Comments

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.


Documentation Feedback