Quantcast
Channel: Forums - ArcObjects SDKs
Viewing all articles
Browse latest Browse all 1374

Refer to the document/application in an add-in?

$
0
0
Is it possible to refer to the Application/document in an add-in?

I've successfully attached a dockable window to a button - now what do I do?

It doesn't seem to like:

Dim pMxDoc As IMxDocument = new MxDocument
nor can you do:

Dim pMxDoc As IMxDocument = m_application.Document
or maybe you can but how do you set m_application in a dockable window?

ANSWER: Add the lines in bold

Private m_pApp As ESRI.ArcGIS.Framework.IApplication

Public Sub New(ByVal hook As Object)
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
Me.Hook = hook
m_pApp = hook

End Sub
.....
then down in your button_click do:

Dim pMxDocument As IMxDocument = m_pApp.Document

Thanks!

Viewing all articles
Browse latest Browse all 1374

Trending Articles