XLL+ Class Library (7.0)

CXlControlListBox::SelectString

Searches for and selects a string in a single-selection list box

int SelectString(
   int nStartAfter,
   const char* pszFind
);

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

pszFind

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.

Return Value

The index of the selected item if the search was successful. If the search was unsuccessful, the return value is -1 and the current selection is not changed.

Remarks

Searches for a list-box item that matches the specified string, and if a matching item is found, it selects the item.

The list box is scrolled, if necessary, to bring the selected item into view.

An item is selected only if its initial characters (from the starting point) match the characters in the string specified by pszItem.

Use the FindString member function to find a string without selecting an item.

Requirements

Header: xldialog.h

See Also

CXlControlListBox Class | CXlControlListBox Methods