ListBox.Sort

From Xojo Documentation

Method

ListBox.Sort()

Supported for all project types and targets.

Sorts the rows based on the current values of the SortingColumn and ColumnSortDirectionAt properties.

Notes

When AllowExpandableRows is True and a ListBox is sorted, the rows are sorted at all levels of the hierarchy, not just the base level.

To ensure the sort indicator displays after sorting you can force the header to refresh like this:

Listbox1.HasHeader = True

Example

The following example sorts a Listbox in descending order on the first column.

// first column, descending order
ListBox1.ColumnSortDirectionAt(0) = ListBox.SortDescending
ListBox1.SortingColumn = 0 // first column is the sort column
ListBox1.Sort