Results 1 to 5 of 5

Thread: List view

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2001
    Posts
    40

    Question

    How do I sort a number and date data type in List View control. I have tried the sort function in List View but it is only sort by alphabetically

    Can anyone help me ?


  2. #2
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238
    Will this help?

    Code:
    Private Sub lvwCustomer_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader)
        Listview1.SortKey = ColumnHeader.Index - 1
        If Listview1.SortOrder = lvwAscending Then
            Listview1.SortOrder = lvwDescending
        Else
            Listview1.SortOrder = lvwAscending
        End If
        Listview1.Sorted = True
    End Sub

  3. #3

    Thread Starter
    Member
    Join Date
    Jan 2001
    Posts
    40

    Question

    Thank for the reply Chris,

    I have tried it it already. But I am afraid it does not work for date and number.

    The things is that listview always sort alpahabetically. So it treats everything as text.

    Any idea ?

  4. #4
    Lively Member
    Join Date
    Aug 1999
    Location
    Amsterdam
    Posts
    117
    The Listview can't do it, you should look at a work around. For example, use a recordset to sort the data (numbers) and fill the listview again.

  5. #5

    Thread Starter
    Member
    Join Date
    Jan 2001
    Posts
    40
    Thanks

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