You can use the name, it should work but I usually use the GUID. If the tool and the commandbar are in the same project, you can reference the class_Name.ClassId since the class id is a public constant on the class
AddItem(New Guid(cmdMyTool.ClassId))
Thanks for your reply Alexander. My tools are in separate solutions. The code below shows the beginning portion of one of the tools that I'm trying to add to the toolbar. Is there away to use the m.Name or should I just use the class id GUID?Thanks againComClass(WellsUpdate.ClassId, WellsUpdate.InterfaceId, WellsUpdate.EventsId), _
ProgId("DataUpdateTools.WellsUpdate")> _
Public NotInheritable Class WellsUpdate
Inherits BaseCommand
#Region "COM GUIDs"
' These GUIDs provide the COM identity for this class
' and its COM interfaces. If you change them, existing
' clients will no longer be able to access the class.
Public Const ClassId As String = "5ec71862-3712-4b4e-8f31-2e58516eb72f"
Public Const InterfaceId As String = "6c0adce7-40f3-4a77-8cce-5dde019e1533"
Public Const EventsId As String = "ca799000-3199-47f6-802e-6a70735db83c"
#End Region
#Region "COM Registration Function(s)"
<ComRegisterFunction(), ComVisibleAttribute(False)> _
Public Shared Sub RegisterFunction(ByVal registerType As Type)
' Required for ArcGIS Component Category Registrar support
ArcGISCategoryRegistration(registerType)
'Add any COM registration code after the ArcGISCategoryRegistration() call
End Sub
<ComUnregisterFunction(), ComVisibleAttribute(False)> _
Public Shared Sub UnregisterFunction(ByVal registerType As Type)
' Required for ArcGIS Component Category Registrar support
ArcGISCategoryUnregistration(registerType)
'Add any COM unregistration code after the ArcGISCategoryUnregistration() call
End Sub
#Region "ArcGIS Component Category Registrar generated code"
Private Shared Sub ArcGISCategoryRegistration(ByVal registerType As Type)
Dim regKey As String = String.Format("HKEY_CLASSES_ROOT\CLSID\{{{0}}}", registerType.GUID)
MxCommands.Register(regKey)
End Sub
Private Shared Sub ArcGISCategoryUnregistration(ByVal registerType As Type)
Dim regKey As String = String.Format("HKEY_CLASSES_ROOT\CLSID\{{{0}}}", registerType.GUID)
MxCommands.Unregister(regKey)
End Sub
#End Region
#End Region
Private m_application As IApplication
' A creatable COM class must have a Public Sub New()
' with no parameters, otherwise, the class will not be
' registered in the COM registry and cannot be created
' via CreateObject.
Public Sub New()
MyBase.New()
' TODO: Define values for the public properties
MyBase.m_category = "PetroGIS Tools" 'localizable text
MyBase.m_caption = "Wells Update" 'localizable text
MyBase.m_message = "Update Well Data From Database" 'localizable text
MyBase.m_toolTip = "Wells Update" 'localizable text
MyBase.m_name = "PetroGISTools_WellsUpdate" 'unique id, non-localizable (e.g. "MyCategory_ArcMapCommand")