PDA

Click to See Complete Forum and Search --> : sorting


sertev
Oct 15th, 2002, 11:50 PM
I want to sort a listview in ascending order.

When I sort the values from 1 to 1000, I get the following

1
10
100
101
102
....
...
11
110
111
....
12
120
....
13
..
1000
2
20
21
22
...

and so on. Is there any way that I can sort the values so they actually fall into the correct order ... ........ 1,2,3,4,5,6,7,8,910,11,12,13,14 and so on.

Any idea's

Bananafish
Oct 16th, 2002, 04:12 AM
Well, one way would be to format the numbers with leading zeroes when you write it to the list box.

ie,


lstbox.Items.Add intNumber.ToString("0000")