property Column.SortOrder as SortOrderEnum
Specifies the column's sort order.

 TypeDescription 
   SortOrderEnum A SortOrderEnum expression that indicates the column's sort order.  
The SortOrder property determines the column's sort order. By default, the SortOrder property is SortNone. Use the SortOrder property to sort a column at runtime. Use the SortType property to determine the way how the column is sorted. Use the AllowSort property to avoid sorting a column when the user clicks the column. Use the SingleSort property to specify whether the control supports sorting by single or multiple columns. If the control supports sorting by multiple columns, the SortOrder property adds or removes the column to the sorting columns collection. For instance, if the SortOrder property is set to SortAscending or SortDescending the column is added to the sorting columns collection. If the SortOrder property is set to SortNone the control removes the column from its sorting columns collection. The Sort event is fired when the user sorts a column. The SortPosition property changes the position of the column in the control's sort bar. Use the DefaultSortOrder property to specify the column's default sort order, when the user first clicks 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.

The control automatically sorts a column when the user clicks the column's header, if the SortOnClick property is exDefaultSort. If the SortOnClick property is exNoSort, the control disables sorting the items when the user clicks the column's header. There are two methods to get the items sorted like follows: 

Grid1.Items.SortChildren 0, "Column 1", False

The SortType property of the Column object specifies the way how a column gets sorted. By default, a column gets sorted as string. If you need to sort your dates, the following snippet of code should be used:

With Grid1
        With .Columns(0)
            .SortType = SortDate
        End With
End With

If you need to sort a column using your special way you may want to use the SortType = SortUserData, or SortType = SortCellData that sorts the column using CellData / CellSortData property for each cell in the column. In this case, the CellData or CellSortData property holds numeric values only.

 

 


Send comments on this topic.
1999-2017 Exontrol.COM, Software. All rights reserved.