Hi RRuh-esristaff and UHarano-esristaff
Thanks! That definitely helps. Now that I have gotten past that, there is another line of code that is getting an exception, but again, only when a Join is present. Here is a screen shot....hopefully you can help with this too:
Basically, the GetIntersectingField returns a string value to populate the DEPOTAREA field. It only crashes when a Join is present. Again, I'm not really sure why. By stepping through the code the proper values are getting returned. Manually I can do the same edit to the DEPOTAREA field through the Attributes pane without any problems.
Here is the code for the GetIntersectingField, but it seems to be working fine. The DEPOTAREA field is associated with a domain if that makes any difference, but the code works fine with no Join present.
public string GetIntersectingField(MapPoint point, string fieldName, FeatureLayer sourceLayer)
{
try
{
SpatialQueryFilter spatialFilter = new SpatialQueryFilter();
spatialFilter.FilterGeometry = point;
spatialFilter.SpatialRelationship = SpatialRelationship.Intersects;
spatialFilter.SubFields = fieldName;
string fieldValue = "";
int i = 0;
RowCursor gridCursor = sourceLayer.Search(spatialFilter);
Feature feature;
while (gridCursor.MoveNext())
{
using (feature = (Feature)gridCursor.Current)
{
int fieldPosition = feature.FindField(fieldName);
fieldValue = feature[fieldPosition].ToString();
i++;
}
}
if ((fieldName == "CONTRACTNO") && (i > 1))
{
fieldValue = null;
ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("There is more than one intersecting Contract Boundary for ??. Please enter this field in manually.", "Contract Number");
}
return fieldValue;
}
catch (Exception ex)
{
ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(ex.ToString());
return null;
}
}