VB-网格排序函数

‘**************************************
‘ Name: SortFlex
‘通过点击网格列标头,对网格内容进行排序
‘ 参数描述:
SortFlex MSFlexGrid, CollumToSort , StringSortAsBoolean , StringSortAsBoolean …
调用示例:
SortFlex flxProject, flxProject.MouseCol, False, True, True, True
”**************************************
Public Sub SortFlex(FlexGrid As MSFlexGrid, TheCol As Integer, ParamArray IsString() As Variant)
FlexGrid.Col = TheCol

For I = 0 To FlexGrid.Cols – 1
Headline = FlexGrid.TextMatrix(0, i)
Ascend = Right$(Headline, 1) = “+”
Decend = Right$(Headline, 1) = “-”
If Ascend Or Decend Then Headline = Left$(Headline, Len(Headline) – 1)
If I = TheCol Then
If Ascend Then
FlexGrid.TextMatrix(0, i) = Headline & “-”
If IsMissing(IsString(i)) Then
FlexGrid.Sort = flexSortGenericDescending
Else
If IsString(i) Then
FlexGrid.Sort = flexSortStringDescending
Else
FlexGrid.Sort = flexSortNumericDescending
End If
End If
Else
FlexGrid.TextMatrix(0, i) = Headline & “+”
If IsMissing(IsString(i)) Then
FlexGrid.Sort = flexSortGenericAscending
Else
If IsString(i) Then
FlexGrid.Sort = flexSortStringAscending
Else
FlexGrid.Sort = flexSortNumericAscending
End If
End If
End If
Else
FlexGrid.TextMatrix(0, i) = Headline
End If
Next I
End Sub

转载请注明 :IT樵客

此条目发表在 程序设计 分类目录,贴了 标签。将固定链接加入收藏夹。

关于 logger

2010年网络规划设计师证书寻挂靠!

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>