Solved

Listview numeric sort

Posted on 2001-07-10
4
495 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

757 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

20 Experts available now in Live!

Get 1:1 Help Now