method Items.SortChildren (Item as HITEM, ColIndex as Variant, Ascending as Boolean)

Sorts the child items of the given parent item in the control.

TypeDescription
Item as HITEM A long expression that indicates the item's handle.
ColIndex as Variant A long expression that indicates the column's index, a string expression that indicates the column's caption.
Ascending as Boolean A boolean expression that defines the sort order. True means ascending, False means descending.

The SortChildren method will not recurse through the grid, only the immediate children of item will be sorted. After sort, the control ensures that the focused item fits the control's client area. Use the FocusItem property to retrieve the focused item. If your control acts like a simple list you can use the following line of code to sort ascending the list by first column: View1.Items.SortChildren 0, 0, True. To change the way how a column is sorted use SortType property of Column object. The SortChildren property doesn't display the sort icon on column's header.  The control automatically sorts the children items when user clicks on column's header. Use the SortOnClick property to disable sorting columns by clicking in the columns header. Use the SortOrder property to get the column sorted, and to display the sorting icon in the column's header. The EnsureOnSort property prevents scrolling the control's content when the user sorts items. The SortableItem property specifies whether the item keeps its position after sorting. Use the AllowSort property to avoid sorting a column when the user clicks the column.