Executing ICommandItem in vb.net

570
2
02-06-2012 04:31 AM
Highlighted
New Contributor
I need assistance running ArcMap built-in toolbar commands in vb.NET.

Here is a simple Sub that paused my drawing in VBA.

Public Sub pauseDrawing()
Dim pCmdItem As ICommandItem
  Set pCmdItem = Application.Document.CommandBars.Find(arcid.PanZoom_PauseDrawing)
pCmdItem.Execute
End Sub

What is the equivelant to the above in vb.NET?

I realize the ArcID is not available directly in .NET.

I have searched several sites for the solution, and found some that seem like they should work, but they do not.
If anyone can post a snippet, including all IMxDocument and IApplication initialization statements, that would be helpful.

ArcGIS: 10.0
Visual Studio: 2010
SDK: .NET
Reply
0 Kudos
2 Replies
Highlighted
by
Occasional Contributor III
You may have to use esriArcMapUI.PauseDrawingCommand in place of arcid.PanZoom_PauseDrawing. Below link lists the ids for all arcmap builtin objects
http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//00010000029s000000

code migration to vb.net

http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/Walkthrough_Migrating_V...
Reply
0 Kudos
Highlighted
New Contributor
The shortest piece of code that I have working is:

Dim pUID As New UID
pUID.Value = "esriArcMapUI.PauseDrawingCommand"
Dim p As ICommandItem = My.ArcMap.Application.Document.CommandBars.Find(pUID)
p.Execute()
Reply
0 Kudos