ComboBox::FindStringExact

Description

Find the first list-box string (in a combo box) that matches the string specified in lpszFind.

Syntax

int FindStringExact( int nStartAfter, LPCSTR lpszFind )

Parameters

nStartAfter

Specifies the zero-based index of the item before the first item to be searched. When the search reaches the bottom of the list box, it continues from the top of the list box back to the item specified by nIndexStart. If nIndexStart is –1, the entire list box is searched from the beginning.

lpszFind

Points to the null-terminated string to search for. This string can contain a complete filename, including the extension. The search is not case sensitive, so this string can contain any combination of uppercase and lowercase letters.

Return

The zero-based index of the matching item, or CB_ERR if the search was unsuccessful.

Examples

EX1

#include <..\OriginLab\DialogEx.h>

#define IDC_COMBO1 1001
void ComboBox_FindStringExact_ex1(Dialog& MyDlg)
{     
        ComboBox  m_cmbBox;
        m_cmbBox = MyDlg.GetItem(IDC_COMBO1);
        int nCount = m_cmbBox.GetCount();
        
        int nRet = m_cmbBox.FindStringExact(0, "Red");
}

Remark

See Also

header to Include

Control.h