Is there way to check if a row is selected when using row by row cursor
using (ArcGIS.Core.Data.Table GNISFTable = (GNISFLayer as FeatureLayer).GetTable())
{
using (RowCursor rowCursor = GNISFLayer.Search())
{
while (rowCursor.MoveNext())
{
using (ArcGIS.Core.Data.Row row = rowCursor.Current)
//If row is not selected skip
{
fType = row["FEATURE_CLASS"].ToString();
state = row["STATE_ALPHA"].ToString();
county = row["COUNTY_NAME"].ToString();
quad = row["MAP_NAME"].ToString();
};
}
}
}
Solved! Go to Solution.
Hi Oguz,
You can obtain a Selection object from the feature layer, and create a RowCursor based on that.
using (ArcGIS.Core.Data.Selection selectedFeatures = (GNISFLayer as FeatureLayer).GetSelection())
{
using (RowCursor rowCursor = selectedFeatures.Search(null))
{
while (rowCursor.MoveNext())
{
using (ArcGIS.Core.Data.Row row = rowCursor.Current)
//Only selected records will be returned
{
fType = row["FEATURE_CLASS"].ToString();
state = row["STATE_ALPHA"].ToString();
county = row["COUNTY_NAME"].ToString();
quad = row["MAP_NAME"].ToString();
}
}
}
}
Hi Oguz,
You can obtain a Selection object from the feature layer, and create a RowCursor based on that.
using (ArcGIS.Core.Data.Selection selectedFeatures = (GNISFLayer as FeatureLayer).GetSelection())
{
using (RowCursor rowCursor = selectedFeatures.Search(null))
{
while (rowCursor.MoveNext())
{
using (ArcGIS.Core.Data.Row row = rowCursor.Current)
//Only selected records will be returned
{
fType = row["FEATURE_CLASS"].ToString();
state = row["STATE_ALPHA"].ToString();
county = row["COUNTY_NAME"].ToString();
quad = row["MAP_NAME"].ToString();
}
}
}
}