This document is archived and information here might be outdated.  Recommended version.


IToolbarControl.Find Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Controls > ESRI ArcGIS Controls > Interfaces > IT > IToolbarControl Interface > IToolbarControl.Find Method
ArcGIS Developer Help

IToolbarControl.Find Method

Returns the index of the first item containing the given command, menu or palette. Returns -1 if the command is not found.

[Visual Basic .NET]
Public Function Find ( _
    ByVal item As Object _
) As Integer
[C#]
public int Find (
    object item
);
[C++]
HRESULT Find(
  VARIANT item
);
[C++]
Parameters
item [in]

item is a parameter of type VARIANT

Product Availability

Available with ArcGIS Engine.

Description

Returns the index of the first item on the ToolbarControl using the specified IUid , ProgID, ICommand, IMenuDef or IPaletteDef. If the specified command or menu cannot be found -1 is returned.

Errors Returned

1035 800A040B: The subtype specified for the command (possibly in a UID object) is invalid or out of range 

Remarks

To find an item using a Command implementing ICommandSubType pass a UID with its SubType property set.

[C#]
//Find an Item by passing a UID
IUID uId = new UIDClass();
uId.Value = "esriControls.ControlsMapFullExtentCommand";
long lIndex = axToolbarControl1.Find(uId);
//Find an Item by passing a ProgID
string progID = "esriControls.ControlsMapFullExtentCommand";
lIndex = axToolbarControl1.Find(progID);
[Visual Basic .NET]
Dim lIndex As Long
Dim pUid As New UIDClass
Dim sProgID As String

'Find an Item by passing a UID
pUid.Value = "esriControls.ControlsMapFullExtentCommand"
lIndex = AxToolbarControl1.Find(pUid)
MsgBox(lIndex)
'Find an Item by passing a ProgID
sProgID = "esriControls.ControlsMapFullExtentCommand"
lIndex = AxToolbarControl1.Find(sProgID)
MsgBox(lIndex)

See Also

IToolbarControl Interface