property Items.FindItem (Value as Variant, [ColIndex as Variant], [StartIndex as Variant]) as HITEM

Finds an item, looking for Caption in ColIndex colum. The searching starts at StartIndex item.

TypeDescription
Value as Variant A Variant expression that indicates the caption that is searched for.
ColIndex as Variant A string expression that indicates the column's caption, or a long expression that indicates the column's index.
StartIndex as Variant A long value that indicates the index of item from where the searching starts.
HITEM A long expression that indicates the item's handle that matches the criteria.

Use the FindItem to search for an item. Finds a control's item that matches CellValue( 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 search feature within the column.

The following VB sample selects the first item that matches "DUMON" on the first column: 

Grid1.Items.SelectItem(Grid1.Items.FindItem("DUMON", 0)) = True

The following C++ sample finds and selects an item:

#include "Items.h"
CItems items = m_grid.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:

axGrid1.Items.set_SelectItem(axGrid1.Items.get_FindItem("Child 2", 0, 0), true);

The following VB.NET sample finds and selects an item:

With AxGrid1.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.Grid1.Items
	.DefaultItem = .FindItem("Child 2",0)
	if ( .DefaultItem <> 0 )
		.SelectItem( 0 ) = .t.
	endif
endwith