3

I have a vb.net arcmap addin which provide a function to validate geodb topology. But there is a problem, when I am not in editing session and use the function, arcmap will crash. In this case I intend to check whether the map is in editing session.

Is there a way to check whether arcmap is in editing session?

I am using vb.net and arcmap 10.2.

5

You can check for the EditState on the editor extension.

enter image description here

  • Thanks Jay, It works! I have put my code below in case it is useful. – ppLily Sep 9 '14 at 3:06
1

After Jay's help, I have successfully check when arcmap is in editing session, the code is as floows:

    Dim editorUid As New UID()
    editorUid.Value = "esriEditor.Editor"
    m_editor = TryCast(My.ArcMap.Application.FindExtensionByCLSID(editorUid), IEditor3)
    m_editEvents = TryCast(m_editor, IEditEvents_Event)
    If m_editor.EditState = esriEditState.esriStateNotEditing Then
        MsgBox("You must in editing session to validate the topology")
    End If
  • 1
    I'm not familiar with the VB AddIn's but for CSharp, the first 3 lines are duplicate what is in the ArcMap class (internal static class found in your AddIn's namespace), which already exposes an IEditor for AddIn editor extensions. – Jay Cummins Sep 9 '14 at 12:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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