I have an addin for ArcMap 10.2 that has a dockable window. For what it's worth, this dockable window has a DataGridView to which the user can add features for review. These features are added from other buttons and menus that are part of the addin. All of that works fine, as long as the dockable window is not showing when the MXD is loaded.

However, if the dockable window is showing at startup (for example, if the user left it open and saved their MXD at the end of the last session), then I am unable to access the dockable window (or add data to the dockable window), and I get a Null Reference Exception. I assume that there is an already existing copy of the dockable window class somewhere (since the dockable window is visible in ArcMap), but I'm at a loss on how to access it.

I've tried using the DockableWindowManager to get a reference to the dockable window and then close it; I've also tried to see if an existing copy of the class can be found using Marshal.GetActiveObject. Neither of these solve my problem.

Is there a way to get a reference to an existing copy of a dockable window class that I can use?

  • Is it a WinForm or WPF window? Why didn't the DockableWindowManager work? Apr 5, 2016 at 21:24
  • @RichWawrzonek. It's in WinForms. It shows the Dockable Window as it should but for some reason the controls on the UI are not being updated at the start of a new session if the dockable window is left open at the end of the previous session.
    – Turbo
    Apr 5, 2016 at 21:41
  • Well that's a different question than what you asked. You said you couldn't get a reference to the dockable window. Apr 5, 2016 at 22:05
  • I think in my mind I was conflating the dockable window with the class that creates the UI controls. I will accept your answer and post a more focused question. Thanks!
    – Turbo
    Apr 5, 2016 at 22:12
  • You're welcome. You may want to use an extension class with a document event handler to close the dockable window when ArcMap closes. Start up a new question if you need help with that. Apr 5, 2016 at 23:13

1 Answer 1


Have you tried using this pattern:

    Dim windowID = New UIDClass()
    windowID.Value = My.ThisAddIn.IDs.DockableWindow1
    Dim dockableWindow As IDockableWindow = My.ArcMap.DockableWindowManager.GetDockableWindow(windowID)

Where 'DockableWindow1' is the name of your dockable window in the Config.esriaddinx file.

  • Yes, I have. That's the way I've been trying to do it
    – Turbo
    Apr 5, 2016 at 21:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.