Custom listbox sorting
- by Arcadian
I need to sort the data contained within a number of listboxes. The user will be able to select between two different types of sorting using radio boxes, one of which is checked by default on form load. I have created the IF statements needed in order to test whether the checked condition is true for that radio button. but i need some help to create the custom sort algorithms.
Each list with contain similar looking data, the only difference in the prefix with which each line starts. For example each line in the first listbox starts with the prefix "G30" and the second listbox will be "G31" and so on. There are 10 listboxes in total (G30-G39 in terms of prefixes).
The first search algorithm has to sort the lines by the number order of the first 13 chars.
Example:
This is how the data looks before sorting
G35:45:58:11 JG07
G35:45:20:41 JG01
G35:58:20:21 JG03
G35:66:22:20 JG05
G35:45:85:21 JG02
G35:64:56:11 JG03
G35:76:35:11 JG02
G35:77:97:12 JG03
G35:54:29:11 JG01
G35:55:51:20 JG01
G35:76:24:20 JG06
G35:76:55:11 JG01
and this is how it should look after sorting
G35:45:20:41 JG01
G35:45:58:11 JG07
G35:45:85:21 JG02
G35:54:29:11 JG01
G35:55:51:20 JG01
G35:58:20:21 JG03
G35:64:56:11 JG03
G35:66:22:20 JG05
G35:76:24:20 JG06
G35:76:35:11 JG02
G35:76:55:11 JG01
G35:77:97:12 JG03
as you can see, the prefixes are the same. so it is sorted, lowest first, by the next pair integers, then the next pair and the next but not by the value after "JG".
the second sort algorithm will ignore the first 13 chars and sort by order of the value after "JG", highest first.
any help? theres some rep in it for you :)
thanks in advance