DesktopListBox.HeadingIndex

From Xojo Documentation

Property (As Integer )
aDesktopListBox.HeadingIndex = newIntegerValue
or
IntegerValue = aDesktopListBox.HeadingIndex

New in 2021r3

Supported for all project types and targets.

Allows you to get and set the sort column in a DesktopListBox. The first column is numbered zero.

Notes

Using this property sets the sort direction indicator in the header.

You can also sort a ListBox by using the SortingColumn property to set the sort column and the ColumnSortDirectionAt property to set the direction of the sort. Then call the Sort method to do the sort.

Example

This code in the Opening event of a DesktopListBox sorts on the first column:

Me.SortedColumn = 0
Me.ColumnSortDirectionAt(0) = DesktopListBox.SortDirections.Ascending
Me.HeadingIndex = 0
Me.Sort