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

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

 TypeDescription 
   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.  
   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 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. 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: 

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

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

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

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

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

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

 


Send comments on this topic.
© 1999-2006 Exontrol Inc, Software. All rights reserved.