|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Problem with Listview Column Sorting (numbers not getting sorted properly) ...
Hello!
I'm trying to sort the data in a Listview that contains the list of Files/Folders along with their sizes in sub-item. I want to sort the listview content based on Size. However, I found that Listview control does not recognize the numeric data as Numbers and it treats it as Strings while attempting to sort. I found that number 9.1 is shown above 81! This is not a correct sorting, right? Is there any solution for this? To make my query clear, I have created a small Demo program. Please see the code, run the program and you will realize what I'm talking about. Is there any solution for this? I'm not finding any. I have attached the code to this comment. Waiting for your reply ... Regards, Ruturaj. |
|
#2
|
|||
|
|||
|
You're probably trying to sort on text variables. Try converting the data to numerical datatypes. Text strings sort by ascii values, not by the numerical data the string represents.
__________________
====== Doug G ====== I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain |
|
#3
|
|||
|
|||
|
hihi..
i have notice that u are dealing with decimal value, thus even u sort these value before formatting the value, the list will still not be sorted. try formatting value like--> lstTest.ListItems.Add , , "Item - " & Format(value, "#0.00") hope it helps... |
|
#4
|
|||
|
|||
|
Thanks guys for your kind help. Your comments has helped me to find the solution for my query. Thanks a lot for your interest and efforts.
|
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Problem with Listview Column Sorting (numbers not getting sorted properly) ... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|