Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sorting a column in a Listview (numerically)

Status
Not open for further replies.

keertanakiran2899

Programmer
Jan 8, 2003
3
0
0
GB
Hello ,

I am trying to sort the data in a listview (numerically).
i used the ColumnClick event to trap the columnheader and all. I was succesful in sorting the data but the problem is the data is sorted AlphaNumerically. Whereas i am looking for Numeric Sorting. Can anyone has any suggestion

Thanks

Sid
 
Simplest way is to make sure all your values are the same length (pad to left with spaces to maximum length).

So for the values of "3", "32" and "310" you would insert them as " 3", " 32" and "310", etc.

Then when it sorts them alphabetically they'll come out in numerical order.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top