Problems with searching in CComboBox 
Author Message
 Problems with searching in CComboBox

Hallo MFC programmer!

I used the combobox often for listing database items. But I have
problems with searching in the list of the combobox.
I used the method CComboBox::FindString to find an item if the user
input a part of the item in the combobox's edit control. If the user
input is found the listbox should appear and the founded item should
scroll to the top like in the adress input of the MS-Explorer. If the
user like he can choose the item from the list or can continue with

The problem is following: If the user inputs a character and there
exists an item in the list of the combobox beginning with this character
this item is coppied to the edit box although I used the method
CComboBox::FindString for searching and not CComboBox::SelectString
which would explain the problem.

What do I make wrong? I searched in the settings of the combobox in the
resource editor but I don't find a setting which would resolve this

Does anybody knows the solution for this problem?

The code looks like:

void CEditCashierDlg::OnEditchangeCashierName()
// Find input in list of cashier names
CString strCashierName;

// This method should only search and not select in the list of the
int nIndex = m_ctrCashierName.FindString(-1, strCashierName);
if (nIndex == CB_ERR)

m_ctrCashierName.ShowDropDown(); // This method should display the list
m_ctrCashierName.SetTopIndex(nIndex ); // This method should scroll the
founded item to the top of the list


Thanx a lot 4U help!

Tue, 22 Jul 2003 00:04:04 GMT  
 Problems with searching in CComboBox
    It is likely that your combobox has the CBS_DROPDOWNLIST, and not the
CBS_DROPDOWN style.  The difference is that when your edit portion cannot be
edited, it always displays the current item in the list portion.

Thu, 24 Jul 2003 19:12:01 GMT  
 [ 2 post ] 

 Relevant Pages 

1. Problems with searching in CComboBox

2. limit of CComboBox and handling of scrolling event in a CComboBox

3. Newbie problem: CComboBox and ClistCtrl

4. CListBox/CComboBox Problem for Windows CE?

5. CComboBox problem

6. CComboBox problems

7. Problem with calling CComboBox within CListBox

8. Newbie CComboBox problem

9. CComboBox problem in Windows 2000..

10. CComboBox problems - 2 to be exact

11. CComboBox behaviour problem

12. Problem with CComboBox


Powered by phpBB® Forum Software