MFC: CCombobox SetCursel incorrect

782 Views Asked by At

I have a trouble with SetCurSel of MFC.

My combobox has data like this: a, b, c, shop10, shop1, c, d.

I add data for combobox like that, then set cursel is Shop1

m_cbb.AddString(_T("a"));
m_cbb.AddString(_T("b"));
m_cbb.AddString(_T("shop10"));
m_cbb.AddString(_T("shop1"));
m_cbb.AddString(_T("c"));
m_cbb.AddString(_T("d"));

//m_cbb.SetWindowText(_T("shop1"));
m_cbb.SetCurSel(3);
UpdateData(FALSE);

It show Shop1 correct, but when I show combobox, cursel is Shop10.

Cursel incorrect

What is my mistake?

0

There are 0 best solutions below