# 2.2.6.6.5 ComboBox::FindString

## Description

Finds, but doesn't select, the first string that contains the specified prefix in the list box of a combo box

## Syntax

int FindString( int nStartAfter, LPCSTR lpcsz )

## Parameters

nStartAfter

Contains 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 nStartAfter. If –1, the entire list box is searched from the beginning.

lpcsz

Points to the null-terminated string that contains the prefix to search for. The search is case independent, 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_FindString_ex1(Dialog& MyDlg)
{
ComboBox  m_cmbBox;
m_cmbBox = MyDlg.GetItem(IDC_COMBO1);
int nCount = m_cmbBox.GetCount();

int nRet = m_cmbBox.FindString(0, "Red");
}