SortFlex
Handle the sorting of a MSFlexgrid by only one sub-routine. Automatic ascenting and decending displayed by + and - in the Headline.
AI
AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Source Code
'
' 1999 by Dirk Bujna - b_dirk@yahoo.com
'
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
Original Comments (3)
Recovered from Wayback Machine