Sort it before adding to a flexgrid
Try to sort the stuff before adding to flex grid and re-read when choosing another sort column.
I like to use the LisView Control, it lets you sort on every column if you click on the header with just a few lines of code. Numbers and dates are treated as text though
Code:
Private Sub pnlResult_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader)
If pnlResult.Sorted = False Then pnlResult.Sorted = True
If pnlResult.SortOrder = lvwAscending Then pnlResult.SortOrder = lvwDescending Else pnlResult.SortOrder = lvwAscending
pnlResult.SortKey = ColumnHeader.Index - 1
End Sub
I also store column positions and widths on exit, very easy. You could use a hidden listview to sort columns as you like and refresh the grid with it.
On http://vbaccelerator.com is a free Outlook style OCX which is very fast, small and much more cunstomizable then the Listview. It's more a combination between grid and listview control