Incompatible Feature Type Error

Mar 24, 2011 at 6:53 PM

I think this is an issue to correct.

I am bringing in a Polygon (line) layer. If a line layer is selected everything is fine. If I intentionally select a Point layer the message should read:

An incompatible feature type was supplied and was not of type Polygon.

What I am getting is:

An incompatible feature type was supplied and was not of type Point.

I think it detects an illegal Point shapefile type and should inform a Polygon is required not Point.

Here is the code:

           Dim myFS As New FeatureSet

            myFS.Open(myImportShapefile)

            Dim myMapLineLayer As New MapPolygonLayer(myFS)

            ToolStripStatusLabel1.Text = "Status: Adding Shapefile To Map"

            Map1.Layers.Add(myMapLineLayer)

            Map1.ZoomToMaxExtent()

            '***************************************************************
            ' Set The Datatable To Hold Shapefile Data.
            '***************************************************************

            Dim myDT As DataTable

            Dim stateLayer As MapPolygonLayer

            stateLayer = CType(Map1.Layers(0), MapPolygonLayer)

            If Not stateLayer Is Nothing Then

                '***************************************************************
                ' Get the shapefiles attribute table and add to datatable.
                '***************************************************************

                ToolStripStatusLabel1.Text = "Status: Reading Shapefile"

                myDT = stateLayer.DataSet.DataTable

                '***************************************************************
                ' Set the Datagridview Datasource to the datatable.
                '***************************************************************

                DataGridView1.DataSource = myDT

            Else

                ToolStripStatusLabel2.Text = "Result: Shapefile Not Added To Map"

                PromptAsk("Shapefile " & myImportShapefile & " Was Not Added To The Map. A Line Shapefile Is Required.", "Shapefile Error", MsgBoxStyle.OkOnly)

            End If