Select to view content in your preferred language

Hiding an old VB6 ICommand via another Addin Command using .NET C#

521
1
04-21-2014 05:13 AM
GauravGrigo
New Contributor
HI All,

I am facing some issues while trying to disable an old ICommand button written in VB6.
I don't want to make changes to VB6 code as it requires new release of whole solution which contains many other tools and commands.
Hence, I have created new functionality and just want to disable one old Command button; but as per my findings even if I load this old CommandItem I can't disable it as the ".Enabled" property has no setter through COmmandItem. That's logical as well; because there is a class in VB6 which has implemented ICommand and you can't access its Enabled property form outside as there is no setter in that class for this.

Can anyone help me if there is any way to hide or disable the old command button Or replace it with my new .NET code?

Thanks in advance!
0 Kudos
1 Reply
NeilClemmons
Honored Contributor
So, your tool is part of a larger set and you want to replace it with a newer version that will be installed separately?  One solution would be to remove the tool's entry in the ESRI Mx Commands component category.  You would do this in your new tool's installer.  However, I'm not sure exactly how that would affect things.  Are your tools on a toolbar that you define via IToolbarDef?  If so, you could write an extension that installs along with your new tool.  Wire the extension to listen for the NewDocument and OpenDocument events.  Inside these events, get a reference to the toolbar, remove the old tool and add your new tool.
0 Kudos