ArcObjects Library Reference (Controls)  

ICommandPool.FindByUID Method

Searches the command pool for the given UID. Returns matching command if the UID is found or nothing.

ERROR: Syntax information about ICommandPool.FindByUID may not be in D:\ArcGIS\DotNet\ESRI.ArcGIS.Controls.dll

[C++]
HRESULT FindByUID(
  IUID* UID,
  ICommand** pCommand
);
[C++]

Parameters

UID [in]

  UID is a parameter of type IUID

pCommand [out, retval]

  pCommand is a parameter of type ICommand

Product Availability

Available with ArcGIS Engine.

Description

Searches the CommandPool for the specified UID, and returns the matching Command. Returns Nothing if the UID cannot be found. For commands that implement ICommandSubType, the IUID::SubType must be specified, otherwise Nothing will be returned.

Errors Returned

1034 800a040a: The supplied command is invalid

[C#]
UID uID = new UIDClass();
uID.Value = "MyCommandSubTypes.MyCommands";
uID.SubType = 2;

ICommand command = axToolbarControl1.CommandPool.FindByUID(uID);
if (command != null) System.Windows.Forms.MessageBox.Show(command.Name);
[Visual Basic .NET]
Dim pUid As New UIDClass
pUid.Value = "MyCommandSubTypes.MyCommands"
pUid.SubType = 2

Dim pCommand As ICommand
pCommand = AxToolbarControl1.CommandPool.FindByUID(pUid)
If Not pCommand Is Nothing Then System.Windows.Forms.MessageBox.Show (pCommand.Name)

See Also

ICommandPool Interface

.NET Snippets

Add Editing Commands to ToolbarControl