I have a simple editable combo box on my dialog.
It has several predefined text values in the drop list. One of those entries is:
"Test 123"
The combo box is mapped to a CString variable m_strNotes.
If I do this:
m_strNotes = _T("Test");
UpdateData(FALSE);
I find that the combo box ends up with "Test 123" selected!
Instead, I have to use m_cbTextValues.SetWindowText(_T("Test")); and kind of bypass using the m_strNotes variable.
Why do I have to do this? Since CComboBox can be editable, the text does not have to be in the drop list. So when I use the former method why doesn't it just set the edit text and not try to find a suitable match in the drop list data?
That is the expected behavior you get with
DDX_CBStringwhich does a prefix string compare for the selection. Rather useDDX_CBStringExactfor an exact match.