BCGControlBar Pro for MFC
void CBCGPGridCtrl::SetSortColumn ( int  nColumn,
BOOL  bAscending = TRUE,
BOOL  bAdd = FALSE 
)

Set the current sorting column and sort order

Call this member function to set the current sorted column and the sort order. The header control will display the sort arrow according to this information.

If bAdd is TRUE this column will be added to the list of sort columns. The grid control must be multiple sorted, otherwise the library asserts in debug mode. If bAdd is FALSE and the grid control is in multiple sort mode, the list of sorted columns is cleared first. You can enable multiple sort using EnableMultipleSort().

Parameters
bAscendingSpecifies the sort order. TRUE - ascending order, FALSE - descending order.
bAddSpecifies whether the specified column should be added to the current list of sort columns. When bAdd is set to TRUE, the grid control must be in the multiple sort mode.
nColumnThe zero-based index of a header control item whose column is sorted.