Solved

Listview numeric sort

Posted on 2001-07-10
4
496 Views
Last Modified: 2007-12-19
Hi, I have two columns in my listview control, one a string and one a number. I have coded it so it is sorted on the click event of the column header. How do I get the number field to sort numerically instead of as a string?
Thanks
0
Comment
Question by:TurnerP
4 Comments
 
LVL 38

Expert Comment

by:PaulHews
ID: 6269074
If you format your numbers with enough leading zero's the alphabetical sort will do:

For 0 to 999--

Format(intNum, "000")

000
001
002
...
999
0
 
LVL 49

Expert Comment

by:Ryan Chong
ID: 6269075
Hi TurnerP,

Sorting ListView ListItems Using Callbacks: http://www.mvps.org/vbnet/code/callback/lvsortcallback.htm

'Hope will help.
0
 
LVL 1

Accepted Solution

by:
Sieger earned 50 total points
ID: 6269294
Here's an article/sample code from a guru for sorting by number or date.  He put the code inside the columnheader click event. but it's very easy to make it a procedure.

http://www.codeguru.com/vb/articles/1818.shtml
0
 

Author Comment

by:TurnerP
ID: 6269618
Thanks, I found this very helpful.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now