The following code works for retrieving values within a particular field(Name1), but I want to retrieve mulitple fields. Am I to create multiple variables for each field?
IMxDocument pMxDocument = ArcMap.Application.Document as IMxDocument;
IMap pMap = pMxDocument.FocusMap;
ILayer pLayer = pMap.get_Layer(0);
IFeatureLayer pFeatureLayer = (IFeatureLayer)pLayer;
IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;
ITable pTable = (ITable)pFeatureClass;
ICursor pCursor = pTable.Search(null, false);
int fldIndex = pFeatureClass.Fields.FindField("Name1");
IRow pRow = pCursor.NextRow();
while (pRow != null)
{
MessageBox.Show(pRow.get_Value(fldIndex).ToString());
pRow = pCursor.NextRow();
}
Edit: What I'm trying to do is get the selected features of a feature class, get the values for fields like Name, address, city, etc and then pass those values onto a document. I thought I would give some background to what I am doing since I may be on the wrong track to start off with.