You can sort data in the control and specify a column or row index to sort on as well as the sort criteria.
Use the SortRange method to sort data.
This example uses the SortRange method.
CS |
Copy Code |
---|---|
for (int i = 0; i < 10; i++) { gcSpreadSheet1.Sheets[0].SetValue(i, 0, i); } private void Button_Click_1(object sender, RoutedEventArgs e) { gcSpreadSheet1.Sheets[0].SortRange(0, 0, 10, 1, true, new GrapeCity.Xaml.SpreadSheet.Data.SortInfo[] { new GrapeCity.Xaml.SpreadSheet.Data.SortInfo(0, false) }); } |
VB |
Copy Code |
---|---|
For i As Integer = 0 To 9 GcSpreadSheet1.Sheets(0).SetValue(i, 0, i) Next Private Sub Button_Click_1(sender As Object, e As RoutedEventArgs) gcSpreadSheet1.Sheets(0).SortRange(0, 0, 10, 1, True, New GrapeCity.Xaml.SpreadSheet.Data.SortInfo() {New GrapeCity.Xaml.SpreadSheet.Data.SortInfo(0, False)}) End Sub |