Reputation: 507
Pseudo Code:
CListBox listBox;
CString[10] str; //consider it is initialised with valid string
for(int i=0; i<10 ; i++)
listBox.AddString(str[i]);
Whenever I add an entry/string to a CListBox
object using the function AddString()
, the MFC CListBox
sorts the entries automatically as each string is added.
How do I explicitly tell MFC to keep the items in the same order they are added (without sorting).
PS: I do NOT want to use the function InsertString()
or so.
Thanks!
Upvotes: 2
Views: 4786
Reputation: 1774
In Properties
tab there is a Sort
property. Set it's value to False
.
Edit:
As @The Forest And The Trees already mentioned, you could achieve same result from code:
listBox.ModifyStyle(LBS_SORT);
Upvotes: 9