polyline problems

Discussion created by alex116 on Mar 8, 2012
Latest reply on Mar 21, 2012 by kenbuja
I want to load lines from a text file and display them as a layer.
The points are in this format:

with the tab and enter characters in parenthesis only so you can see the formatting that is used.

I am thinking the best idea would be to write them to a shape file so they can be opened as a normal shape file. That way the shape file can be loaded normally.
I have written some code but its not working and need some help with it.
Here is what I have so far:

        Dim pWkspFact As IWorkspaceFactory = New ShapefileWorkspaceFactory
        Dim pDocumentFact As IWorkspaceFactory = New TextFileWorkspaceFactory

        Dim pFeatWksp As IFeatureWorkspace = pWkspFact.OpenFromFile("c:\temp", 0)
        Dim pDocWksp As IFeatureWorkspace = pDocumentFact.OpenFromFile("c:\temp", 0)

        Dim pTable As ITable = pDocWksp.OpenTable("lines.txt")

        Dim pCLSID As UID = New UID
        pCLSID.Value = "esriGeoDatabase.Feature"

        ' Use IFieldChecker to create a validated fields collection.
        Dim fieldChecker As ESRI.ArcGIS.Geodatabase.IFieldChecker = New ESRI.ArcGIS.Geodatabase.FieldCheckerClass()
        Dim enumFieldError As ESRI.ArcGIS.Geodatabase.IEnumFieldError = Nothing
        Dim validatedFields As ESRI.ArcGIS.Geodatabase.IFields = Nothing
        fieldChecker.ValidateWorkspace = CType(pFeatWksp, ESRI.ArcGIS.Geodatabase.IWorkspace)
        fieldChecker.Validate(pTable.Fields, enumFieldError, validatedFields)
        Dim original As Fields = pTable.Fields
        Dim clonedoriginal As IClone = original
        Dim clonednew As IClone = clonedoriginal.Clone
        Dim newfields As IFields = clonednew

        Dim pFeatcls As IFeatureClass = pFeatWksp.CreateFeatureClass("LineFC", newfields, pCLSID, Nothing, esriFeatureType.esriFTSimple, "Shape", "")


The code fails on "pFeatWksp.CreateFeatureClass" with a COMException E_FAIL

I am using version 10.

I am open to suggestions of how to achieve this through other methods as well.