Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I want to sort Listview columns by size ( 512 KB, 0.25 MB etc )

Column1:
filename1
filename2
filename3
filename4

Column2:
512 KB
0.25 MB
344 MB
1920 KB

I have searched for it but all the results is sorting like this ( which is not a numerical sort )
1
10
2
3

So is there any simple solution?
Posted

1 solution

Hi,

Have a look here:
http://stackoverflow.com/a/1214333[^]
 
Share this answer
 
Comments
Leecherman 25-Aug-13 7:49am    
thanks for your reply.
this solution doesn't works if there is a numeric followed by strings ( like 1230 KB )
Thomas Daniels 25-Aug-13 8:23am    
Make two seperate columns: one column for the number (1230) and one column for KB, MB, ...
Then, first sort by KB, MB, ... and then by number.
Leecherman 25-Aug-13 8:40am    
unfortunately i have more than 10 columns ( not just have size values but other values which have numerics followed by strings ) so this will not be a proper method to do that.
thanks again.
Thomas Daniels 25-Aug-13 8:44am    
There's another solution. Have a look here:
http://stackoverflow.com/a/508264

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900