I am trying to delete a feature programmatically, and what seems easy is not working properly. I have tried several methods all result in the feature being deleted, but not the row in the table. I then get a failed to draw because there is no shape associated with the row. I tried all three methods below inside and outside of an edit session with the same results.
Thanks in advance
The feature was created with:
Dim pFeature As IFeature = pFeatureClass.CreateFeature pFeature.Shape = pPoint pFeature.store
I'm surprised the pFeature.Delete did not work which suggests to me the source of your problem is something else, what format is your data store as? If it's ArcSDE then maybe some weird locking is going on? I would try you code on a small sample of say a shapefile?
Thanks for your reply. I am doing this on a test data set stored as a shapefile. I am accessing the feature class through the map as opposed to the providing the path. I suppose a locking issue is possible. I will investigate. Thanks.
Could it be an issue with the feature not being created properly in the first place?
As I understand it a Feature is nothing more than a row in a table where one of the fields just happens to hold a geometry rather than all fields being non-spatial data. So I don't see why you can't have a row (feature) where all values are set to NULL, this should still be a valid row in your table (featureclass). Anybody out there do correct me if I am wrong?
So you dataset is a "simple" shapefile and when you issue a delete is sets everything to NULL but does does not remove the row from the table? Maybe you could post up your code for us to see?
When I delete the row the row (with attributes and Shape field) remain in tact. In the directory there was an additional lock file being created that I still cannot explain, so I am going another route. Thanks for the help.