With a selection of features from the same layer in ArcMap, a user clicks on a tool that autopopulates some fields based on some spatial queries. There is a loop to handle when more than one feature is selected.
Before the loop starts I do this:
ar editOperation = new ArcGIS.Desktop.Editing.EditOperation();
editOperation.Name = "Create new Facility IDs";
var insp = new ArcGIS.Desktop.Editing.Attributes.Inspector(); //create the Inspector
Then I loop through the code and do what needs to be done. The current selected feature has an attribute that the next selected feature will need to use (ie. to increment it's number by 1), so I do this to save the current features edits:
If I step through my code, up to this point everything is fine and attributes seem to be getting updated. With the next selected feature I will then loop through the code again, but this time my code that looks at the field that needs to increment by one doesn't 'see' the edit made the first time through, so the counter ends up being the same as the previous edit.
At the end of the looping, I do this:
If I select features one at a time and run things, all is good. It's only when doing multiple selections. Is editOperation.Modify the right method to call and get things saved to the database?? If I run .Modify and .Execute right after the other, then I get a Null Reference the next time I go through the loop....I guess that means I need to recreate the EditOperation each time through, which I don't want to do.
Any ideas on where I am going wrong??