DesktopListBox.Sort

From Xojo Documentation

Method

DesktopListBox.Sort()

New in 2021r3

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 DesktopListBox 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 code sorts a Listbox in descending order on the first column.

// first column, descending order
ListBox1.ColumnSortDirectionAt(0) = DesktopListBox.SortDirections.Descending
ListBox1.SortingColumn = 0 // first column is the sort column
ListBox1.Sort