Hello,
I am putting together a c# Add-In using Visual Studio Community 2019. I also have a ComboBox int he Add-In containing a list of feature codes being read from a dbase table.
I'd like to be able to do the following...
Whenever a new feature is created in any of the layers in my current MXD, populate a field on the feature just created with the current value of the ComboBox.
I am not sure how to get the name of the ComboBox control and reference it another *.cs file.
I am aware of the the Editing_EditEventListener sample, but there is more to that solution than I really need. I tried copying the EventListener.cs file from that solution and adding it to my own project (I removed the portions of code referring to events other than OnCreateFeature to make it easier to read). I added the code below to EventListener_OnCreateFeature, but nothing happens when I do that. Perhaps I need more than just the EventListener.cs file from the Developer sample?
IEditLayers ieLayers = (IEditLayers)m_editor;
IFeatureLayer pFLayer = ieLayers.CurrentLayer;
IFeatureCursor pFCur = pFLayer.Search(null, false);
IFeature pFeat = pFCur.NextFeature();
m_editor.StartOperation();
// use dummy value until I can get the ComboBox Value
pFeat.Value[pFeat.Fields.FindField("FEAT_CODE")] = "xyz";
pFeat.Store();
m_editor.StopOperation("FeatureCodeUpdate");
I don't doubt there are flaws in the code I've added, but I believe the first step is getting the OnCreateFeature editor event to listen and fire whenever a new feature is added. Hoping someone can get me pointed in the right direction.
Thanks,
Carl