2

What is the .NET code equivalent for this general ArcMap command syntax:

Application.Document.CommandBars.Find(ArcID.Query_ClearSelection).Execute()

I have been using this one below as a work around, however it is much more code than what I would like to use.

Dim pUID As New UID
Dim pCmdItem As ICommandItem
'Use the GUID of the Save command
pUID.Value = "{AB073B49-DE5E-11D1-AA80-00C04FA37860}"
'or you can use the ProgID
'pUID.Value = "esriArcMapUI.MxFileMenuItem"
pUID.SubType = 3
pCmdItem = m_App.Document.CommandBars.Find(pUID)
pCmdItem.Execute()
nmtoken
13.6k5 gold badges39 silver badges91 bronze badges
asked Jun 8, 2011 at 17:21

1 Answer 1

1

That's about the best way that you can do it (that I know of).

You might be able to tack on Execute at the end of your pCmdItem assignment, i.e.

pCmdItem = m_App.Document.CommandBars.Find(pUID).Execute()

but that's the only "optimization" I can think of. A lot of overhead is taken care of when you're using ArcMap rather than ArcEngine.

answered Jun 8, 2011 at 18:12
2
  • So, there is not a newer variation to the "ArcID" built-in module, becuase this only existed within ArcMap VBA? Commented Jun 8, 2011 at 18:20
  • @artwork21 Not to my knowledge. GUIDs and ProgIDs are all I've ever used to access tools on the toolbar. Commented Jun 8, 2011 at 19:01

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.