Select to view content in your preferred language

How to use ArcMap Existing Command in C# .Net(Arcobject).

2805
1
04-28-2013 11:41 PM
MadanBurathi
Deactivated User
Hi All,

My name is Madan Burathi, I am new in Arcobject can any one please tell me how convert following VBA code to C# code.
Actually my intention is how to use Arcmap existing commands in .Net Environment. It will be a great help.


Dim pCommandItem As ICommandItem
Set pCommandItem = ThisDocument.CommandBars.Find(ArcID.Query_ZoomToSelected)
If (pCommandItem Is Nothing) Then Exit Sub
pCommandItem.Execute



       Regards
   Madan Burathi
Software Developer.
0 Kudos
1 Reply
BarbaraSchneider1
Deactivated User
Hi Madam,

here is the code in C#:

UID uid = new UID();
uid.Value = "{AB073B49-DE5E-11D1-AA80-00C04FA37860}";
ICommandItem cmdItem = application.Document.CommandBars.Find(uid, false, false);
cmdItem.Execute();


Instead of specifying the GUID, you can also specify the name, e.g. uid.Value = "esriArcMapUI.SelectTool"
You can find this information at: http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/index.html#//00010000029s000000

Barbara
0 Kudos