This content has been marked as final. Show 2 replies
I took another look at this issue this morning, and after studying the Carto OMD (see attachment) realized that I should be able to simplify the code like this:
Dim pFL2 As IFeatureLayer2 = pLayer Dim pFCursor As IFeatureCursor = pFL2.Search(Nothing, True) Dim pFeature As IFeature = pFCursor.NextFeature Dim pBag As IGeometryCollection = New GeometryBag Do Until pFeature Is Nothing pBag.AddGeometry(pFeature.Shape, , 0) pFeature = pFCursor.NextFeature Loop
But the same error occurs during the Search assignment.
fl2.PNG 31.9 K
The documentation on IFeatureLayer2::Search says:
This Search method will not work on joined fields. If the FeatureLayer has any joins, you should use the IGeoFeatureLayer::SearchDisplayFeatures method instead.
Dim pGFL As IGeoFeatureLayer = pLayer Dim pFCursor As IFeatureCursor = pGFL.SearchDisplayFeatures(Nothing, True)
Hope this thread helps someone in the future.