AnsweredAssumed Answered

What is wrong with this vb.net code?

Question asked by jsn on Aug 15, 2018
Latest reply on Aug 15, 2018 by jsn

Hello everyone,

 

I am working with VS 2015 and ArcGIS 10.4.1.

 

I am trying to select polygons form a Parcel layer using the folio number and union them to copy the union in another polygon layer.

 

From this sample:

http://edndoc.esri.com/arcobjects/9.2/NET/11bc37dc-197b-4ddd-bc0d-2b11c4ca7747.htm

 

 

I wrote this source code:

 

 

' Use the WhereClause property to select only those that match tghe criteria

queryFilterPaParcel = New QueryFilterClass()

queryFilterPaParcel.SubFields = "FOLIO"

queryFilterPaParcel.WhereClause = ""

'

' Create list of folios

'

For i = 0 To listFolios.Count - 1

strFolioWhereClause = strFolioWhereClause & "FOLIO = '" & listFolios.Item(i).ToString & "' "

If i < listFolios.Count - 1 Then

strFolioWhereClause = strFolioWhereClause & " AND "

End If

Next

'

' Select Folios in Parcels Layer (psde2.MDC.PaParcel) Database

'

queryFilterPaParcel.WhereClause = strFolioWhereClause

pParcelCursor = pFeatureClassParcel.Search(queryFilterPaParcel, False)

 

currentFeature = pParcelCursor.NextFeature()

 

pTopoOp = currentFeature.Shape     

 

********************************************  IT FAILS HERE  WITH TIS ERRROR MESSAGE:

 

Error HRESULT E_FAIL has been returned from a call to a COM component.

 

Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\ESRI.ArcGIS.Geometry\v4.0_10.4.0.0__8fc3cc631e44ad86\ESRI.ArcGIS.Geometry.dll'. Cannot find or open the PDB file.

Exception thrown: 'System.Runtime.InteropServices.COMException' in

 

************************************************************************************************************************************

 

If Not (currentFeature Is Nothing) Then

Dim missing As Object = Type.Missing

geometryCollection.AddGeometry(currentFeature.Shape, Nothing, Nothing)

currentFeature = pParcelCursor.NextFeature()

End If

'Create the polygon that will be the union of the features returned from the search cursor.

'The spatial reference of this feature does not need to be set ahead of time. The

'ConstructUnion method defines the constructed polygon's spatial reference to be the same as

'the input geometry bag.

Dim unionedPolygon As ITopologicalOperator = New PolygonClass()

unionedPolygon.ConstructUnion(geometryBag)

Dim outPoly As IPolygon = CType(unionedPolygon, IPolygon)

Outcomes