kpearson272

issue with getFields in arcobjects snippet

Discussion created by kpearson272 on Jun 3, 2013
Latest reply on Jun 3, 2013 by RoboRubik
I'm trying to use the following snippet to acquire the field values of a feature in ArcMap, but I don't have the definition for getFields(recieve error).  I've tried looking at the online help for IFeatureCursor and IFields, but I'm new to arcobjects and I can't find a solution.  I've added as many referneces as I can, thinking that was the problem, but no such luck.  I also don't know where I specify what feature I want to use inside this code either(the remainder of this code is located at
http://edndoc.esri.com/arcobjects/9.2/Java/java/quickstarts/quickstart_code.htm "Work with the attributes of a feature class")


IFeatureCursor featureCursor = featureClass.search(null, true);
IFields fields = featureCursor.getFields();
int fieldCount = fields.getFieldCount();
for (int i = 0; i < fieldCount; i++) {
  IField fieldI = fields.getField(i);
  String fieldName = fieldI.getName();
  System.out.print(fieldName + "\t");}
System.out.println();

Outcomes