How to sort a combobox after it has been created ?
I have a combobox which doesn't have the CBS_SORT style and after adding some items I'd like to offer the ability for the user to sort it alphabetically by clicking on a given button.
How can I sort the combobx after it has been created and some items added to it ?
Re: How to sort a combobox after it has been created ?
You have to destroy (or hide) this combox and create (or show) another one with the CBS_SORT style and then populate this new one with the same item list.
Re: How to sort a combobox after it has been created ?
Re: How to sort a combobox after it has been created ?
or
get the contents of the combobox into an array
clear the combobox
sort the array
fill the combobox in sorted order from the array
Re: How to sort a combobox after it has been created ?
Why not just create it initially with the CBS_SORT style?