Select to view content in your preferred language

Error caused byIEditor.AbortOperation called at IEditorEvents.OnCreateFeature handler

801
0
11-05-2013 09:40 PM
SuiHuang
Frequent Contributor
Hi Everybody:

    I wrote some C# code like this:

IEditor m_editor = ...
IFeatureClass featCls = ...

(m_editor as IEditorEvents_Events).OnCreateFeature = ... // the handler calls m_editor.AbortOperation in some situation
m_editor.StartOperation();
IFeature feat = featCls.CreateFeature();
// modify feat
feat.Store();
m_editor.StopOperation("Create Feature");



When the code is execute, the IEditorEvents.OnCreateFeature event handler is triggered when feat.Store() is run. In the event handler if m_editor.AbortOperation is call in some situation to abort the feature creation. However, I got exception:
**************************************
System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.
   at ESRI.ArcGIS.Geodatabase.IFeature.Store()
**************************************

Why does this happen? How can I let the event handler abort the operation?

Thank you!
0 Kudos
0 Replies