This document is archived and information here might be outdated. Recommended version. |
ArcObjects Help for .NET developers > ArcObjects namespaces > Controls > ESRI ArcGIS Controls > Interfaces > IT > IToolbarControl2 Interface > IToolbarControl2.Find Method (ArcObjects .NET 10.5 SDK) |
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,
long* pVal
);
[C++]
Parameters item [in] item is a parameter of type VARIANT pVal [out, retval] pVal is a parameter of type long
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.
To find an item using a Command implementing ICommandSubType pass a UID with its SubType property set.
//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);
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)