CListbox "Sort" property: how to change it during runtime
Posted on 2014-03-06
I have a CListbox control on a CDialog in my VC++ MFC application. In the resource editor (ie, in design time), I have the "Sort" property intentionally set to FALSE. However, I'd like to be able to change the value of the CListbox "Sort" property to TRUE while the program is running. For example, if the user clicks a button on the dialog, change the "Sort" property to TRUE.
I know I could "manaully" sort the contents of the CListbox at runtime (load them into a CString array, alphabetize them, clear the CListbox contents, and then reload the now-alphabetized contents in the CString array back into the CListbox). Tha'ts fine. I'd also just like to know how to programmatically set the "Sort" property.
Thanks very much!