PDA

Click to See Complete Forum and Search --> : List view


ocin
Feb 1st, 2001, 02:45 AM
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 ?

Chris
Feb 1st, 2001, 11:55 AM
Will this help?


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

ocin
Feb 1st, 2001, 07:28 PM
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 ?

gijsj
Feb 1st, 2001, 07:54 PM
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.

ocin
Feb 2nd, 2001, 12:29 AM
Thanks