The following example uses the Sort and TextMatrix properties. It performs a ModHFGrid sort according to the value of a ComboBox control. To use the example, place a ModHFGrid control and a ComboBox control on a form. Paste the following code into the Declarations section and then press F5.
Private Sub Combo1_Click() ' Select Column according to Sort method. Select Case Combo1.ListIndex Case 0 To 2 ModHFGrid1.Col =1 Case 3 To 4 ModHFGrid1.Col =2 Case 4 To 8 ModHFGrid1.Col =1 End Select ' Sort according to Combo1.ListIndex. ModHFGrid1.Sort =Combo1.ListIndex End Sub Private Sub Form_Load() Dim i As Integer ' Fill ModHFGrid with random data. ModHFGrid1.Cols =3 ' Create three columns. For i =1 To 11 ' Add ten items. ModHFGrid1.AddItem "" ModHFGrid1.Col =2 ModHFGrid1.TextMatrix(i, 1) =SomeName(i) ModHFGrid1.TextMatrix(i, 2) =Rnd() Next i ' Fill combo box with Sort choices With Combo1 .AddItem "flexSortNone" ' 0 .AddItem "flexSortGenericAscending" '1 .AddItem "flexSortGenericDescending" '2 .AddItem "flexSortNumericAscending" '3 .AddItem "flexSortNumericDescending" '4 .AddItem "flexSortStringNoCaseAsending" '5 .AddItem "flexSortNoCaseDescending" '6 .AddItem "flexSortStringAscending" '7 .AddItem "flexSortStringDescending" '8 .ListIndex =0 End With End Sub Private Function SomeName(i As Integer) As String Select Case i Case 1 SomeName ="Ann" Case 2 SomeName ="Glenn" Case 3 SomeName ="Sid" Case 4 SomeName ="Anton" Case 5 SomeName ="Hoagie" Case 6 SomeName ="Traut 'Trane" Case 7 SomeName ="MereD Wah" Case 8 SomeName ="Kemp" Case 9 SomeName ="Sandy" Case 10 SomeName ="Lien" Case 11 SomeName ="Randy" End Select End Function