ArcObjects Library Reference  (Carto)    

IFind Interface

Provides access to members that control finding.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.


Method Find Finds the specified search string in the given attribute fields.
Read-only property FindDisplayField The display field.
Read-only property FindFields The attribute fields.

CoClasses that implement IFind

CoClasses and Classes Description
CadAnnotationLayer An ESRI Cad annotation layer.
CadFeatureLayer ESRI CAD Feature Layer class.
CoverageAnnotationLayer An ESRI coverage annotation layer.
DimensionLayer A collection of properties for a dimension layer.
FDOGraphicsLayer A collection of properties for an annotation layer (feature data object graphics layer).
FeatureLayer A collection of features and their visual representation.
GdbRasterCatalogLayer Geodabase RasterCatalog source and display options.
MADtedLayer (esriDefenseSolutions) A layer used to control the display of MA DTED Catalogs.
MapServerFindSublayer Provides programmatic access to a map server sublayer with Find capability.
MapServerQuerySublayer Provides programmatic access to a map server sublayer with Find and Identify capability.
MARasterLayer (esriDefenseSolutions) A layer used to control the display of MA RPF Catalogs.
TemporalFeatureLayer (esriTrackingAnalyst) Defines the coclass IDL parameters and attributes of the TemporalFeatureLayer COM object.


IFind is a simple interface that can be used to search for a string in the attributes of Features of a layer.  If the full Find dialog is needed, execute the appropriate Find command from esriControls instead.

[Visual Basic 6.0]

The following VBA example demonstrates how to do a simple search for features using IFind::Find.  To display the full Find window, see the code example "Display the Find Window" below.

Public Sub SampleFind()

Dim pFind As IFind
Dim pMxDoc As IMxDocument
Dim pFeatureLayer As IFeatureLayer
Dim pTrackCancel As ITrackCancel

Set pMxDoc = ThisDocument
Set pFeatureLayer = pMxDoc.FocusMap.Layer(0)
Set pFind = pFeatureLayer

Dim pArray As IArray
' "3090" is what I am searching for
Set pArray = pFind.Find("Hill", True, pFind.FindFields, pMxDoc.ActiveView.ScreenDisplay.CancelTracker)

If pArray Is Nothing Then
    MsgBox "No Features were found"
Exit Sub
End If

Debug.Print pArray.count

Dim pFeatureFindData As IFeatureFindData2
Dim count As Long

'the array is an array of FeatureFindData objects
For count = 0 To (pArray.count - 1)
    Set pFeatureFindData = pArray.Element(count)
    'do something with the feature
    MsgBox "Found Feature: " & pFeatureFindData.Feature.OID & " in Layer " & pFeatureFindData.Layer.Name
Next count

End Sub


Display the Find Window