Sorting in Flexgrid-VBForums
Results 1 to 2 of 2

Thread: Sorting in Flexgrid

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2011
    Posts
    74

    Sorting in Flexgrid

    whenever a user click on the header of the flexgrid then which function can show its list ascending / desending.

    any sugestion.

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,135

    Re: Sorting in Flexgrid

    If you're using VB6 then see if this sample works for you:
    Code:
    Option Explicit
    
    Private Sub Form_Load()
    Dim i As Integer
    Dim j As Integer
    
        With MSFlexGrid1
            .Rows = 10
            .Cols = 5
            For j = 0 To .Rows - 1
                For i = 0 To .Cols - 1
                    .TextMatrix(j, i) = j + 1 * (i + 1)
                Next i
            Next j
        End With
        MSFlexGrid1_Click 'force sort asc
    
    End Sub
    
    Private Sub MSFlexGrid1_Click()
    Static sortA As Boolean
    
        With MSFlexGrid1
            .RowSel = .Row
            .Col = .Col
            .ColSel = .Col
            If Not sortA Then
                .Sort = flexSortGenericAscending
                sortA = True
            Else
                .Sort = flexSortGenericDescending
                sortA = False
            End If
        End With
    
    End Sub
    Also, original idea was posted here. Read all the comments.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.