The ListItem's appearance in a ListView
is also determined by the sorting properties.
Three properties—Sorted, SortKey, and
SortOrder—determine the order of ListItems
in a ListView control.
The Sorted property can have one of two values,
True or False. If Sorted is False, the items
in the ListView are not sorted. If the Sorted
property is set to True, the ListItems will
be sorted with an order that depends on the
other two properties: SortKey and SortOrder.
The values of SortOrder and SortKey are ignored
unless the Sorted property is set to True.
SortOrder specifies whether the ListItems
appear in ascending (lvwAscending) or descending
(lvwDescending) order. Ascending order is the
default for SortOrder. SortKey identifies on
what the items in the list will be sorted. By
default the items in the list will be sorted
by the Text property of the ListItems.
If your ListView is in a report format with multiple columns, you can sort
by using the text value of any of the columns by setting the SortKey property
to the desired column. If SortKey is 0, the list will be sorted by the ListItems().Text
property. If SortKey is greater than 0, the sort will take place using one of
the additional report columns in the control (described in the following page).
ListView Control topics