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

Discussion created by alphamale on May 8, 2013
Latest reply on May 8, 2013 by gilest
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.
' 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