|
-
Apr 11th, 2000, 05:50 AM
#1
Thread Starter
Lively Member
Hi vb-world:
I have problem with a list view in mode Report, my first column is numeric and consecutive, and when I use the sort property the numbers shows like this, "1,10,11,12... 2,20,21... etc", How can I order or what need to do to the list view order this column consecutively?
Thanks a lot in advance.
Regards.
Angel Maldonado López.
VB Programmer
-
Apr 12th, 2000, 12:25 AM
#2
Addicted Member
Sorting stuff in listview controls is always a pain. It uses a dumb sort that doesn't take into account what it is sorting. Just for fun, try sorting dates in mm/dd/yyyy format. It sorts everything as if it were a string. I almost always sort before putting into the listview. I've seen workarounds in this forum before, but don't recall what they are.
-
Apr 12th, 2000, 12:44 AM
#3
New Member
If you are inserting data from an array of records you could implement your own sort instead of relying on generally stupid Microsoft sorts. Most common sort procedures are Selection Sort(slowest), Bubble Sort(quick for middle-size databases) and Quick Sort (the quickest one) 
Here's an example of a bubble sort:
(record is person and we want to sort by field name)
Procedure Bubblesort (byval numberofrecords)
declare last,current as integer
temp as personrecord
for last = numberofrecords downto 2
for current = 1 to last-1
if person(current).name < person(current+1).name then
temp = person(current)
person(current) = person(current+1)
person(current+1) = temp
endif
endfor
endfor
endproc
You'll end up having records sorted by name...hope it helps!
-
Apr 12th, 2000, 03:48 AM
#4
Thread Starter
Lively Member
Thank you very much, I'm going to try these.
Angel Maldonado López.
VB Programmer
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|