If you want to sort the data in the FlexGrid, then you should use the <i>col</i>, <i>colsel</i> and <i>sort</i> properties of the control. If you want to get the data sorted from the data source (DataEnvironment), then I think you would need to modify the command text property of the command object.
Assuming that you want to sort the data in the control, this is the way to do it.
The keys used for sorting are determined by the Col and ColSel properties, for example, if you want to sort the data according to the contents of columns 1 and 2, you should set those properties this way:
<pre>MSHFlexGrid1.Col = 1
MSHFlexGrid1.ColSel = 2</pre>
Then you have to set the <i>sort</i> property according to the following possible values:
<pre>Constant Value Description
flexSortNone 0 None. No sorting is performed.
flexSortGenericAscending 1 Generic Ascending. An ascending sort, which estimates whether text is string or number, is performed.
flexSortGenericDescending 2 Generic Descending. A descending sort, which estimates whether text is string or number, is performed.
flexSortNumericAscending 3 Numeric Ascending. An ascending sort, which converts strings to numbers, is performed.
flexSortNumericDescending 4 Numeric Descending. A descending sort, which converts strings to numbers, is performed.
flexSortStringNoCaseAsending 5 String Ascending. An ascending sort using case-insensitive string comparison is performed.
flexSortNoCaseDescending 6 String Descending. A descending sort using case-insensitive string comparison is performed.
flexSortStringAscending 7 String Ascending. An ascending sort using case-sensitive string comparison is performed.
flexSortStringDescending 8 String Descending. A descending sort using case-sensitive string comparison is performed.
flexSortCustom 9 Custom. This uses the Compare event to compare rows.
</pre>
For example:
<pre>MSHFlexGrid1.Sort = 1</pre>
hello i need a little help on how to sort the data in flexgrid 1-50. i can’t sort the numbers i am trying to save 1 – 9 it’s ok but when i save 10 to 19 it’s look like this:
1
10
11
2
3
4
5
6
7
8
9
how will i solve this problem for it to become like this
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
and so on thanks for the help in advance