Select to view content in your preferred language

Implement cancel button on dockable window

1915
2
08-16-2010 12:27 PM
LesleyBross
Deactivated User
I am new to VB .NET and am converting a VBA form and its associated code to VB .NET. I need to put a cancel button on the form that closes the dockable window. Resetting the enclosed form object would be nice but I could do that manually. I've been able to unload the form from the button event but this leaves behind a blank dockable window. I've gotten a handle to the dockable window using the IDockableWindowManager from the form but get an error message about managed execution inside an OS Loader lock. Any thoughts? It seems like this should be a simple task so I hope I'm missing something obvious. Thanks -- Lesley
0 Kudos
2 Replies
NeilClemmons
Honored Contributor
To close the window, call IDockableWindow.Show and pass in False.
0 Kudos
LesleyBross
Deactivated User
Thank you! I believe I tried that in the 9.3 environment and got the managed execution error. However... since originally posting this question I have updated to v10 and am using the add-in framework. IDockableWindow.Show works fine. Here is the code:

        ' Close dockable window when OK button is clicked
    Private Sub cmdOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdOK.Click
        Dim dockWinID As UID = New UIDClass()
        dockWinID.Value = My.ThisAddIn.IDs.frmAOIInfo
        Dim dockWindow As ESRI.ArcGIS.Framework.IDockableWindow = My.ArcMap.DockableWindowManager.GetDockableWindow(dockWinID)
        dockWindow.Show(False)
    End Sub
0 Kudos