Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Listview numeric sort

Posted on 2001-07-10
4
Medium Priority
?
518 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 54

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 200 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

916 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