ducksunlimited

Close an existing form after stopping an editing session

Discussion created by ducksunlimited on Sep 15, 2011
Latest reply on Sep 17, 2011 by Hornbydd
HI ALL,

I am developing a button add-in for ArcMap 10. When an user starts an editing session, the button is activated and if you click it, a window form appear. Then after I stop the editing session, the form will be closed. I am struggled with closing the form after I stop the editing session - after I stop editing, how to construc the codes to close the exsiting form. Here are the codes for Sub OnClick() and Sub Update(). Any help would be appreciated.

Russel

Protected Overrides Sub OnClick()
        Dim frm As New frmAssessment
        ......
        If ... Then
            frm.Show()
            Exit Sub
        Else
           MessageBox (..)
           Exit Sub
        End IF
        ......
End Sub

Protected Overrides Sub OnUpdate()
        Dim frm As New frmAssessment

        Dim pID As New UIDClass()
        Dim pEditor As IEditor

        pID.Value = "esriEditor.Editor"
        pEditor = My.ArcMap.Application.FindExtensionByCLSID(pID)

        If pEditor.EditState = esriEditState.esriStateEditing Then
            Me.Enabled = True
        Else
            Me.Enabled = False
            frm.Hide()
        End If
    End Sub

Outcomes