This document is archived and information here might be outdated. Recommended version. |
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
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.
1035 800A040B: The subtype specified for the command (possibly in a UID object) is invalid or out of range
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)