Problem creating shapefile

401
1
05-21-2012 07:41 AM
Highlighted
New Contributor
Hello everyone!

since I installed ArcEngine, I get this error

"COM target does not implement IDispatch"

when I create a shapefile.

This code works perfectly before installing ArcEngine 😞


' Open the folder to contain the shapefile as a workspace

Dim pWorkspaceFactory As IWorkspaceFactory
pWorkspaceFactory = New ShapefileWorkspaceFactory
Dim pFWS As IFeatureWorkspace
pFWS = pWorkspaceFactory.OpenFromFile(strFolder, 0)

' Set up a simple fields collection
Dim pFields As IFields
Dim pFieldsEdit As IFieldsEdit
pFields = New Fields
pFieldsEdit = pFields

Dim pField As IField
Dim pFieldEdit As IFieldEdit

' Make the shape field
' it will need a geometry definition, with a spatial reference
pField = New Field
pFieldEdit = pField
pFieldEdit.Name2 = strShapeFieldName TargetInvocationException occurred
pFieldEdit.Typ2e = esriFieldType.esriFieldTypeGeometry

Any idea?

Thanks, Mar
Reply
0 Kudos
1 Reply
Highlighted
New Contributor
Sorry, I have just realised that the method is name_2, not name2.

So, problem solved!!!
Reply
0 Kudos