Problem creating shapefile

05-21-2012 07:41 AM
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
0 Kudos
1 Reply
New Contributor
Sorry, I have just realised that the method is name_2, not name2.

So, problem solved!!!
0 Kudos