Enable / disable a button when start / stop an editing session

Discussion created by ducksunlimited on Sep 12, 2011
Latest reply on Sep 14, 2011 by ducksunlimited
HI All,

Hope I can get some help here.

I have an ArcGIS 10 add-in (IDE VB.NET Express 2008) with a button. I want this button to be enabled only when an editing session is started. Here is what I got. Also I added the onDemand = "Flase" property for the button. Any help would be appreciated.

Protected Overrides Sub OnUpdate()
        Dim application As ESRI.ArcGIS.Framework.IApplication = Nothing

        Dim pID As New UIDClass()
        pID.Value = "esriEditor.Editor"

        Dim pEditor As IEditor
        pEditor = application.FindExtensionByCLSID(pID)

        If pEditor.EditState = 1 Then
            Me.Enabled = True
        End If
    End Sub