AnsweredAssumed Answered

How to save edits after operation

Question asked by agray1 on Feb 28, 2012
Latest reply on Feb 29, 2012 by agray1
I have a requirement to save the edit session after a set number of edit operations.  I do the save in the ieditevents2.onstopoperation.  It works fine for lines in a file geodatabase but for points in the same geodatabase, it crashes arcmap.  It works ok for change or delete point but for create point, it crashes arcmap.  No exception, the save is ok, arcmap just crashes after all the code is executed correctly.
I created a little sample arcmap extension that saves after every edit:


Private m_application As IApplication   Private m_editor As IEditor   Private m_editEvents As IEditEvents2_Event     Public Sub Shutdown() Implements ESRI.ArcGIS.esriSystem.IExtension.Shutdown     RemoveHandler m_editEvents.OnStopOperation, AddressOf saveedits     m_application = Nothing   End Sub    Public Sub Startup(ByRef initializationData As Object) Implements ESRI.ArcGIS.esriSystem.IExtension.Startup     m_application = CType(initializationData, IApplication)     If m_application Is Nothing Then Return     m_editor = GetEditorFromArcMap(m_application)     m_editEvents = DirectCast(m_editor, IEditEvents2_Event)     AddHandler m_editEvents.OnStopOperation, AddressOf saveedits   End Sub     Private Sub saveedits()     Try       Dim wk As IWorkspace = m_editor.EditWorkspace       m_editor.StopEditing(True)       m_editor.StartEditing(wk)     Catch ex As Exception       Trace.WriteLine(ex)     End Try    End Sub  Any thoughts? 

Outcomes