SortRows(ColumnIndex: Integer; Ascending: Boolean);
SortRows(ColumnIndex: Integer; Ascending: Boolean);
ColumnIndex. Index of the column which values determine how the rows are to be sorted.
Ascending. The parameter that determines sorting direction. If the parameter is set to True, the values are sorted in ascending order.
The SortRows method sorts a row range based on the values from the column with the ColumnIndex index.
After executing the method, the rows are rearranged in such a way that the values in the ColumnIndex column are sorted depending on the sorting order.
To execute the example, a form, a button on this form named Button1, the TabSheetBox component named TabSheetBox1 and a data source for this component are required.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
TabSheetBox1: TabSheetBox;
Range: ITabRange;
Begin
Range := TabSheetBox1.Source.GetTabSheet.Rows(0, 9);
Range.SortRows(0, True);
End Sub Button1OnClick;
After executing the example clicking the button sorts the first ten rows of the table by values of the first column.
To execute the example, a form, a button on this form named Button1, the TabSheetBoxNet component named TabSheetBoxNet1 and a data source for TabSheetBoxNet are required.
Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
Range: ITabRange;
Begin
Range := TabSheetBoxNet1.Source.GetTabSheet().Rows[0, 9];
Range.SortRows(0, True);
End Sub;
After executing the example clicking the button sorts the first ten rows of the table by values of the first column.
See also: