Sorting MSFlexGrid

Sorting MSFlexGrid

Ever wonder how to get the MSFlexGrid to have sorting behavior common inmany Windows applications? That is to say when you double-click on acolumns header it sorts ascending. Double-click again and it sortsdescending. The following code demonstrates the basic modificationsnecessary to make this work. Note: In this sample flexSortGenericAscendingand flexSortGenericDescending are used. Of course you can modify this tosort more specifically based on the column.

 =====================================================================Prerequisites:  Add a grdInformation to your form and populate it.=====================================================================Private mintMyRow As Integer            'Holds Last RowPrivate mintMyCol As Integer            'Holds Last ColPrivate mintLastSort(8) As Integer      'Array with column's lastsort value----------------------------------------------------------------------------Private Sub grdInformation_DblClick()    If mintMyRow = 0 Then             'On header row?    If mintLastSort(mintMyCol) = 1 Then 'Already sorted ascending?      grdInformation.Sort = 2      mintLastSort(mintMyCol) = 2       'Generic Descending    Else      grdInformation.Sort = 1      mintLastSort(mintMyCol) = 1       'Generic Ascending    End If  End If    End Sub----------------------------------------------------------------------------Private Sub grdInformation_MouseDown(Button As Integer, Shift As Integer, xAs Single, y As Single)    mintMyRow = grdInformation.MouseRow    mintMyCol = grdInformation.MouseCol  End Sub
Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several