abridle

How to Disable a Tool control?

Discussion created by abridle on Jan 6, 2012
Latest reply on Jan 6, 2012 by sshetty
Hi,

I'm writing an add-in in VS2010 in VB.Net for ArcMap 10.

I want to run some code whenever the selected tab in a tab control on the displayed form is changed so that it enables and selects the appropriate tool on my toolbar.
I'm using the code below to select the appropriate tool which is working fine but I would also like to disable (grey out) the other tools. Any ideas?

            Dim commandBars As ESRI.ArcGIS.Framework.ICommandBars = My.ArcMap.Application.Document.CommandBars
            Dim commandID As ESRI.ArcGIS.esriSystem.UID = New ESRI.ArcGIS.esriSystem.UIDClass
            commandID.Value = "esriArcMapUI.SelectFeaturesTool"
            Dim commandItem As ESRI.ArcGIS.Framework.ICommandItem = commandBars.Find(commandID, False, False)

            If Not (commandItem Is Nothing) Then
                My.ArcMap.Application.CurrentTool = commandItem
            End If

Outcomes