Sort

This property sets a value that sorts selected rows according to the criteria a user specifies.

Syntax

object.Sort [= value]

Parameters

object
Object expression that evaluates to a Grid control.
value
Integer or constant that specifies the types of sorting. The following table shows the settings for value.
Constant
Value
Description
flexSortNone 0 None
flexSortGenAscend 1 Generic ascending. Guesses whether text is string or number.
flexSortGenDescend 2 Generic descending.
flexSortNumAscend 3 Numeric ascending. Converts strings to numbers.
flexSortNumDescend 4 Numeric descending.
flexSortStrAscend 5 String ascending. Case-insensitive.
flexSortStrDescend 6 String descending. Case-insensitive.
flexSortStrAscendCase 7 String ascending. Case-sensitive.
flexSortStrDescendCase 8 String descending. Case-sensitive.
flexSortCustom 9 Custom. Uses Compare event to compare rows.

Remarks

The Sort property is unavailable at design time. It is write-only at run time.

The Sort property always sorts entire rows. To specify the range to be sorted, set the Row and RowSel properties. If Row and RowSel are the same, the Grid control sorts all nonfixed rows.

The Col and ColSel properties determine the keys used for sorting. Keys are always sorted from left to right. For example, if Col = 3 and ColSel = 1, the sort is done according to the contents of column 1, then 2, then 3.