I am trying to update a field value according to the selected OBJECTID. But get System.NullReferenceException error. Don't know what's wrong with the code.
My code is as follows:
pActiveView = pMxDoc.FocusMap pMxDoc = My.ArcMap.Application.Document pMap = pMxDoc.FocusMap Dim layerNum = GetIndexNumberFromLayerName(pActiveView, "dev_db.DBO.Segment") Dim pFLayer As IFeatureLayer pFLayer = pMap.Layer(layerNum) Dim featureClass As ESRI.ArcGIS.Geodatabase.IFeatureClass = pFLayer.FeatureClass Dim feature As IFeature = pFLayer.GetFeature(1) Dim nameFieldIndex As Integer = pFLayer.FindField("Seg_ID") feature.Value(nameFieldIndex) = "12/11" feature.Store()
The method is called in an editing session, and confirm has the OBJECTID 1 in the specified layer.
I am using arcobjects 10.2.2 and vb.net arcmap add-in.