Hello.
I have a ListBox that displays information from my database, and I'm simulating columns using tabs between values. All the values are retrieved directly from fields in the database save one, which is a calculation of two other values (a percentage ratio). I can easily sort the other fields using the database engine, but I'm having trouble sorting by the calculated field (which, not surprisingly, is what my users want it to do).
I found and began using the BubbleSort algorithm, which does a terrific job sorting the percentage values, but now I'm lost as to how to sort the ListItems() strings into the same order. In other words, I have an array of Percentages(), and an array of ListItems(). Once the Percentages() array is sorted, how can I populate the ListBox with ListItems() using the sorted Percentages() array?
BTW: BubbleSort (and all others I've found) doesn't work on arrays of UDT's, so that shot that idea down, too :-(
Thanks for any ideas.
-Mike
Difference between a madman and a genius:
A madman uses his genius destructively,
A genius uses his madness constructively.
I have a ListBox that displays information from my database, and I'm simulating columns using tabs between values. All the values are retrieved directly from fields in the database save one, which is a calculation of two other values (a percentage ratio). I can easily sort the other fields using the database engine, but I'm having trouble sorting by the calculated field (which, not surprisingly, is what my users want it to do).
I found and began using the BubbleSort algorithm, which does a terrific job sorting the percentage values, but now I'm lost as to how to sort the ListItems() strings into the same order. In other words, I have an array of Percentages(), and an array of ListItems(). Once the Percentages() array is sorted, how can I populate the ListBox with ListItems() using the sorted Percentages() array?
BTW: BubbleSort (and all others I've found) doesn't work on arrays of UDT's, so that shot that idea down, too :-(
Thanks for any ideas.
-Mike
Difference between a madman and a genius:
A madman uses his genius destructively,
A genius uses his madness constructively.