I have a CListBox and a toggle button( Ascending / Descending sort switch
mode ) on my application.
All the items in the ListBox are CString types.
I want to make so that if I click the button all the CListBox items will be
sorted alphabetically Asc / Desc.
How to do that?
Thank you very much.
I would suggest you to look a CListBox::CompareItem :
http://msdn.microsoft.com/en-us/library/aa295532(VS.60).aspx
Giovanni
One cheat is to have a member variable which is the "polarity" of the sort: 1 for
ascending (set in the constructor) and -1 for descending. Then all you have to do is
multiply the result you compute by the polarity to get the up/down sort.
joe
Joseph M. Newcomer [MVP]
email: newc...@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm