Searches for a list-box item that matches the specified string, and if a matching item is found, it selects the item.
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 nStartAfter is –1, the entire list box is searched from the beginning.
Points to the null-terminated string that contains the prefix to search for. The search is case independent, so this string may contain any combination of uppercase and lowercase letters.
The list box is scrolled, if necessary, to bring the selected item into view.
This member function cannot be used with a list box that has the LBS_MULTIPLESEL style.
An item is selected only if its initial characters (from the starting point) match the characters in the string specified by lpszItem.
Use the FindString member function to find a string without selecting the item.
// The pointer to my list box. extern CListBox* pmyListBox; // The string to match. extern LPCTSTR lpszmyString; // Select the item that begins with the specified string. int nIndex = pmyListBox->SelectString(0, lpszmyString); ASSERT(nIndex != LB_ERR);