SortColumns(RowIndex: Integer; Ascending: Boolean);
SortColumns(RowIndex: Integer; Ascending: Boolean);
RowIndex. Index of the row values of which determine how the columns are to be sorted.
Ascending. The parameter that determines sorting direction. If this parameter is True sorting is ascending, otherwise the sorting is descending.
The SortColumns method sorts the column range depending on the values, which are contained in the row with the RowIndex index.
After executing the method, the columns are rearranged in such a way that the values of the RowIndex always remain ordered regardless of the sorting order.
Executing the example requires the following components: a form, a button on this form named Button1, the TabSheetBox component named TabSheetBox1 and a data source for this component.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
Range: ITabRange;
Begin
Range := TabSheetBox1.Source.GetTabSheet.Cells(0, 0, 10, 3);
Range.SortColumns(0, True);
End Sub Button1OnClick;
As a result when the button is clicked, the columns in the range "A0:D10" will be rearranged in such a way that the values in the "0" row are sorted in the ascending order.
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().Cells[0, 0, 10, 3];
Range.SortColumns(0, True);
End Sub;
As a result when the button is clicked, the columns in the range "A0:D10" will be rearranged in such a way that the values in the "0" row are sorted in the ascending order.
See also: