ColSort Property

Returns or sets the sorting order for each column (for use with the Sort property).

Syntax

[form!]VSFlexGrid.ColSort(Col As Long)[ = SortSettings ]

Remarks

This property allows you to specify different sorting orders for each column on the grid. The most common settings for this property are flexSortGenericAscending and flexSortGenericDescending. For a complete list of possible settings, see the Sort property.

To perform the sort using the settings assigned to each column, set the Sort property to flexSortUseColSort.

To sort dates, set the column's ColDataType property to flexDTDate.

For example, the following code sorts the grid so that the first row is in ascending order, the second is ignored, and the third is in descending order:

    Private Sub Form_Load()

        fg.Cols = 4

        fg.ColSort(1) = flexSortGenericAscending

        fg.ColSort(2) = flexSortNone

        fg.ColSort(3) = flexSortGenericDescending

    End Sub

    Private Sub Command1_Click()

        fg.Select 1, 1, 1, 3

        fg.Sort = flexSortUseColSort

    End Sub

Data Type

SortSettings (Enumeration)

See Also

VSFlexGrid Control