-1

I created point features. but ı cant do add data attribute table.

IMxDocument pMxdoc = ArcMap.Application.Document as IMxDocument;
IPoint pPoint = pMxdoc.ActivatedView.ScreenDisplay.DisplayTransformation.ToMapPoint(arg.X, arg.Y);
IFeatureLayer pFLayer = pMxdoc.FocusMap.Layer[3] as IFeatureLayer;
IWorkspaceEdit pWSE = ((IDataset)(pFLayer.FeatureClass)).Workspace as IWorkspaceEdit;
pWSE.StartEditing(false);
pWSE.StartEditOperation();

IFeature pFeature = pFLayer.FeatureClass.CreateFeature();
pFeature.Shape = pPoint;
pFeature.Store();

// I want to add data in table this here but how?

pWSE.StopEditOperation();
pWSE.StopEditing(true);

pMxdoc.ActivatedView.Refresh();
Romano Zumbé
  • 7,893
  • 4
  • 33
  • 55

1 Answers1

3

You´re only assigning a geometry to the feature, but you may need further attributes. Thus you should set the attribute-values for your current feature using set_Value:

int fieldIndex = myFeatureClass.FindField(attributeName);
object newValue = "newValue";
IFeature pFeature = pFLayer.FeatureClass.CreateFeature();
pFeature.set_Value(fieldIndex, newValue);
pFeature.Shape = pPoint;
pFeature.Store();
MakePeaceGreatAgain
  • 35,491
  • 6
  • 60
  • 111