Private Sub MSFlexGrid1_Click()
if msflexgrid1.mouserow=0 then
if haha=false then
with msflexgrid1
.Col=.mousecol
.sort=1 'sort的值又好几个,建议查一下msdn
end with
haha=true
else
with msflexgrid1
.Col=.mousecol
.sort=2
end with
haha=false
end if
End Sub
MSHFlexGrid1.Sort [=value]
value值如下
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.
The Sort property always sorts entire rows. To specify the range to be sorted, set the Row and RowSel properties. If Row and RowSel are the same, the MSHFlexGrid will sort all non-fixed rows.
The keys used for sorting are determined by the Col and ColSel properties. Sorting is always done in a left-to-right direction. For example, if Col =3 and ColSel =1, the sort is done according to the contents of columns 1, then 2, then 3.