![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a collection where the items in the collection are dates. I want to iterate over the collection and build a value list string for the rowsource of a listbox. The dates in the collection are not in chronological order. Is there a way to first sort the collection and put the dates in chronological order before creating the value list string? Or, how would I iterate over the collection pulling out the dates in chronological order? Thanks! Scott |
#3
| |||
| |||
|
|
On Thu, 16 Dec 2004 03:17:49 GMT, "Scott" <smiller (AT) nospam (DOT) please wrote: One idea would be to use a disconnected ADO recordset to hold your collection. You can create one out of thin air. They are sortable. |
|
Another would be to use a sorting algorithm, e.g. bubblesort or qsort. |
#4
| |||
| |||
|
|
I have a collection where the items in the collection are dates. I want to iterate over the collection and build a value list string for the rowsource of a listbox. The dates in the collection are not in chronological order. Is there a way to first sort the collection and put the dates in chronological order before creating the value list string? Or, how would I iterate over the collection pulling out the dates in chronological order? Thanks! Scott |
#5
| |||
| |||
|
|
I want to iterate over the collection and build a value list string for the rowsource of a listbox. |
#6
| |||
| |||
|
|
could the BubbleSort method perhaps be used? http://chrisrae.com/vba/routines/bubblesort.html |
#7
| |||
| |||
|
|
Jesper F wrote: could the BubbleSort method perhaps be used? http://chrisrae.com/vba/routines/bubblesort.html Unless the array is relatively small, Bubblesort has the awful O(N^2) running time. Do you want to create a Quicksort function too? -- Bas Cost Budde, Holland http://www.heuveltop.nl/BasCB/msac_index.html I prefer human mail above automated so in my address replace the queue with a tea |
#8
| |||
| |||
|
|
The collection will have ten items at most. How can I apply the bubblesort routine to rearranging the dates in the collection to chronological order? |
#9
| |||
| |||
|
|
Scott wrote: The collection will have ten items at most. How can I apply the bubblesort routine to rearranging the dates in the collection to chronological order? One other question first: how do the dates get into this collection? If you can do any form of insertion sort, that would save a lot of effort. I can make a sorting function for a collection "tomorrow" (whatever that means on this earth, taking time zones into consideration--mine is GMT+1) but maybe you can play a bit: Create a new collection * loop the old collection, comparing every element to the new collection * insert the element in the right place Return the new collection (don't forget to clean up the old one!) -- Bas Cost Budde, Holland http://www.heuveltop.nl/BasCB/msac_index.html I prefer human mail above automated so in my address replace the queue with a tea |
#10
| |||
| |||
|
|
I have a collection where the items in the collection are dates. I want to iterate over the collection and build a value list string for the rowsource of a listbox. The dates in the collection are not in chronological order. Is there a way to first sort the collection and put the dates in chronological order before creating the value list string? Or, how would I iterate over the collection pulling out the dates in chronological order? |
![]() |
| Thread Tools | |
| Display Modes | |
| |