Results 1 to 3 of 3

Thread: Want to do sort in MS Flex Grid ?

  1. #1

    Thread Starter
    Addicted Member chander's Avatar
    Join Date
    Nov 2000
    Location
    New Delhi , India
    Posts
    225
    I want to do sorting on single coulumn data in MsFlexgrid.
    I don't bother whether it is numeric,character or string .
    But by using sort property of MSFlex grid control all other columns having data got unordered means , my selected column
    is sorted but other coulumns get unordered.I set the Row ,Col , Rowsel and Colsel property by values for which i want sorting before sorting it . but still all other columns
    data disperse .

    Or any other idea of sorting in VB , if I have a list of strings ( it may be numeric , string , alphabet as in Excel)
    I can put sorted values later in grid if i sort them externally thru any other technique .

    I would appreciate and thankful if any one helps me on this.

    Chander
    Chander
    Email:[email protected]

  2. #2
    Member
    Join Date
    Oct 2000
    Location
    Netherlands
    Posts
    54

    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
    A mind is like a parachute, it has to open to let it work
    www.2beesoft.com for Icon Manager with over 20.000 free icons
    VB6 Ent. SP4, ASP, W2000/W98

  3. #3

    Thread Starter
    Addicted Member chander's Avatar
    Join Date
    Nov 2000
    Location
    New Delhi , India
    Posts
    225

    Cool


    thanks for suggestion , though i have written my own code for sorting in Flex Grid , yet i will try using list view ot other OCX on vbaccelerator.com if it sort efficiently.
    if it clicks then my sorting time will be reduce.

    thanks

    Chander
    Chander
    Email:[email protected]

Posting Permissions

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



Click Here to Expand Forum to Full Width