Finds an item, looking for Caption in ColIndex column. The searching starts at StartIndex item.
Type | Description | |||
Caption as Variant | A Variant expression that indicates the caption that is searched for. | |||
ColIndex as Variant |
A long expression that indicates the column's index or the cell's handle, a string expression that indicates the column's caption. | |||
StartIndex as Variant | A long value that indicates the index of item from where the searching starts. Use the ItemToIndex property to convert the handle of the item to an index. | |||
HITEM | A long expression that indicates the item's handle that matches the criteria. Use the ItemToIndex property to convert the handle of the item to an index |
Use the FindItem to search for an item. Finds a control's item that matches CellCaption( Item, ColIndex ) = Caption. The StartIndex parameter indicates the index from where the searching starts. If it is missing, the searching starts from the item with the 0 index. The searching is case sensitive only if the ASCIIUpper property is empty. Use the AutoSearch property to enable incremental searching within the column.
The following VB sample selects the first item that matches "DUMON" on the first column:
Tree1.Items.SelectItem(Tree1.Items.FindItem("DUMON", 0)) = True
The following C++ sample finds and selects an item:
#include "Items.h" CItems items = m_tree.GetItems(); COleVariant vtMissing; long hFind = items.GetFindItem( COleVariant("King"), COleVariant("LastName"), vtMissing ); if ( hFind != NULL ) items.SetSelectItem( hFind, TRUE );
The following C# sample finds and selects an item:
axTree1.Items.set_SelectItem(axTree1.Items.get_FindItem("Child 2", 0, 0), true);
The following VB.NET sample finds and selects an item:
With AxTree1.Items Dim iFind As Integer iFind = .FindItem("Child 2", 0) If Not (iFind = 0) Then .SelectItem(iFind) = True End If End With
The following VFP sample finds and selects an item:
with thisform.Tree1.Items .DefaultItem = .FindItem("Child 2",0) if ( .DefaultItem <> 0 ) .SelectItem( 0 ) = .t. endif endwith