Hi,
I'm working with the OnDeleteFeature Event. Is there a way to stop the 'Delete' from happening? I'm trying to code the event so if a certain criteria is met, then it won't delete the feature. But if not met, then the feature can be deleted.
Here is my code....pretty simple. The way I have it now, everything gets deleted. How do I stop the delete process??
private void Events_OnDeleteFeature(IObject obj)
{
try
{
//Check to see if current obj is a Feature.
if (obj is IFeature)
{
//Cast to an IFeature
IFeature inFeature = (IFeature)obj;
ITable inTable = obj.Table;
//Look for the Maximo field and edit.
if (inFeature.Fields.FindField("MXCREATIONSTATE") != -1)
{
inFeature.set_Value(inFeature.Fields.FindField("LifeCycleStatus"), "REMOVED");
//MessageBox.Show("SET TO REMOVED");
return;
}
else
{
MessageBox.Show("DELETE IT");
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "Error in onDeleteFeature procedure.");
}
}