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


ICommandPool.FindByUID Method (ArcObjects .NET 10.6 SDK)
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.

[Visual Basic .NET]
Public Function FindByUID ( _
    ByVal UID As UID _
) As ICommand
[C#]
public ICommand FindByUID (
    UID UID
);
[C++]
HRESULT FindByUID(
  IUID* UID
);
[C++]

Parameters UID [in]
UID is a parameter of type IUID*

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