Friend Module ArcMap Private s_app As ESRI.ArcGIS.Framework.IApplication Private s_docEvent As ESRI.ArcGIS.ArcMapUI.IDocumentEvents_Event Public ReadOnly Property Application() As ESRI.ArcGIS.Framework.IApplication Get If s_app Is Nothing Then s_app = TryCast(Internal.AddInStartupObject.GetHook(Of ESRI.ArcGIS.ArcMapUI.IMxApplication)(), ESRI.ArcGIS.Framework.IApplication) End If Return s_app End Get End Property Public ReadOnly Property Document() As ESRI.ArcGIS.ArcMapUI.IMxDocument Get If Application IsNot Nothing Then Return TryCast(Application.Document, ESRI.ArcGIS.ArcMapUI.IMxDocument) End If Return Nothing End Get End Property Public ReadOnly Property ThisApplication() As ESRI.ArcGIS.ArcMapUI.IMxApplication Get Return TryCast(Application, ESRI.ArcGIS.ArcMapUI.IMxApplication) End Get End Property Public ReadOnly Property DockableWindowManager() As ESRI.ArcGIS.Framework.IDockableWindowManager Get Return TryCast(Application, ESRI.ArcGIS.Framework.IDockableWindowManager) End Get End Property Public ReadOnly Property Events() As ESRI.ArcGIS.ArcMapUI.IDocumentEvents_Event Get s_docEvent = TryCast(Document, ESRI.ArcGIS.ArcMapUI.IDocumentEvents_Event) Return s_docEvent End Get End Property End Module
<ArcMap> <Commands> <Button id="Acme_ToggleDockWinBtn" class="ToggleDockWinBtn" caption="OpenDockWin" category="Acme Tools" image="Images\ToggleDockWinBtn.png" tip="Toggle dockable window." message="Open dockable window."> <Helpheading="Toggle">Turns the ACME dockable window on and off.</Help> </Button> </Commands> </ArcMap>
Just came across this issue. Using .NET, it was saying the exact same thing about My.ArcMap not a member. Well, it turned out to be simple. The assembly when building was defaulting to have onDemand="true".
Just add onDemand="false" to Config.esriaddinx inside the <Button /> brackets.