Syntax 1: For ListBox, DropDownListBox, and RibbonComboBoxItem
controls
Description
Finds the next item in a ListBox that begins with the specified
search text.
Applies to
ListBox, DropDownListBox, PictureListBox, DropDownPictureListBox,
and RibbonComboBoxItem controls
Syntax
|
1 |
listboxname.FindItem ( text, index ) |
|
Argument |
Description |
|---|---|
|
listboxname |
The name of the ListBox control in which you want to |
|
text |
A string whose value is the starting text of the item |
|
index |
The number of the item just before the first item to be |
Return value
Integer.
Returns the index of the first matching item. To match, the item
must start with the specified text; however, the text in the item can be
longer than the specified text. If no match is found or if an error
occurs, FindItem returns -1. If any argument’s value is null, FindItem
returns null.
Usage
When FindItem finds the matching item, it returns the index of the
item but does not select (highlight) the item. To find and select the
item, use the SelectItem function.
Examples
Assume the ListBox lb_actions contains the following list:
|
Index number |
Item text |
|---|---|
|
1 |
Open files |
|
2 |
Close files |
|
3 |
Copy files |
|
4 |
Delete files |
Then these statements start searching for Delete starting with
item 2 (Close files). FindItem sets Index to 4:
|
1 2 |
integer Index Index = lb_actions.FindItem("Delete", 1) |
These statements search for items in the RibbonBar
ComboBox:
|
1 2 3 4 5 6 |
Integer li_Return RibbonComboBoxItem lr_ComboBox li_Return = lr_ComboBox.AddItem("Item1") li_Return = lr_ComboBox.AddItem("Item2") li_Return = lr_ComboBox.FindItem("Item2",0) |
See also