1

When I create new feature in editing session, I need to determine the new created feature is in which layer because after that have further more action on the layer. I wonder can this be done in vb.net arcobjects?

I am using vs2012 and arcmap 10.2.

1 Answer 1

4

Yes. You need to respond to the IEditEvents.OnCreateFeature which returns an object of type IFeature which has a property Class which will give you the feature class it belongs to.

After you have the feature class belonging to the new feature you can iterate through your editable layers (using IEditLayers.IsEdtiable) and see if the (ILayer as IFeatureLayer).FeatureClass matches - this will tell you what layer it is.

2
  • Thanks Michael, looks little complicated. Would trouble you if I still get problem in it.
    – ppLily
    Commented Sep 5, 2014 at 5:57
  • It is (sort of) complicated, event programming is a little bit daunting at the start. You are using VB.net which is a little easier than C# when it comes to events. There's a little too much code to post in an answer - if you have a problem with one of the concepts you will get more detailed help with it like : How do I wire and respond to IEditEvents.OnCreateFeature in ArcGis? There are a few sample scripts around to show you how on the Esri help but they can be a little confusing. Commented Sep 7, 2014 at 21:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.