Cannot obtain reference to Application

353
2
06-16-2011 09:59 AM
ESRICustomer
New Contributor III
My Environment:

  • ArcObjects 9.3.1

  • VB.NET

  • Visual Studio 2008

I have built a user control (see attached pic) that uses the toolbar, table of contents control, and map control.

I am trying to access built in commands to use through code.

It's my understanding that to do this I need to be able to get to the CommandBars class by
Application.Document.CommandBars.Find(UID)

If a standalone application based on ArcEngine does not have Application, then how do people writing this type of application execute commands.

If this is relevant, when I open a map document (mxd), this is the meat of the code involved in that...

Private _esriIMapDoc As IMapDocument
Private _esriMapControl As ESRI.ArcGIS.Controls.AxMapControl    

Public Sub OpenMxd(ByVal MxdFileNameAndPath As String)

    _esriIMapDoc = New MapDocument

    _esriIMapDoc.Open(MxdPathAndFileName, "")

    _esriMapControl.Map = _esriIMapDoc.Map(0)

End Sub
0 Kudos
2 Replies
RichardWatson
Frequent Contributor
I think Application comes with ArcMap, i.e. you have to be running the ArcGIS Desktop application to use this.  I get the sense that you are writing a stand-alone application based on ArcEngine.
0 Kudos
ESRICustomer
New Contributor III
I think Application comes with ArcMap, i.e. you have to be running the ArcGIS Desktop application to use this.  I get the sense that you are writing a stand-alone application based on ArcEngine.


You're correct, I am writing a standalone app based on ArcEngine.  I revised my original post to reflect this fact.
0 Kudos