Problem on Getting Values From Attribute Table of a Shapefile

Aug 3, 2012 at 12:26 AM

Hi,

I am trying to list attribute table of a shapefile in a Datagridview by using this example.But I am encountering with this error at fs.Open("D:\\work\\test.shp"); line of code.

'DotSpatial.Data.FeatureSet.Open(string)' cannot be accessed with an instance reference; qualify it with a type name instead

Can you please let me know why this is happening?

using System.Windows.Forms;
using DotSpatial.Topology;
using DotSpatial.Data;

 private void btnBuffer_Click(object sender, EventArgs e)
        {
            FeatureSet fs = new FeatureSet();
            fs.FillAttributes();
            fs.Open("D:\\work\\test.shp");
            DataTable dtOriginal = fs.DataTable;
            for (int row = 0; row < dtOriginal.Rows.Count; row++)
            {
                object[] original = dtOriginal.Rows[row].ItemArray;
            }
        }
Thanks for your time in advance,

Developer
Aug 3, 2012 at 3:42 PM

FeatureSet has changed. Now to create a new one from a file you would use:

FeatureSet fs = FeatureSet.Open(filename);
Aug 3, 2012 at 5:07 PM

Thanks Vatvain,

I will test it tomorrow. 

Aug 21, 2012 at 8:10 PM
Edited Aug 21, 2012 at 8:15 PM

Thanks works fine...

C#:
FeatureSet fs = FeatureSet.Open(filename);

VB.NET:
Dim fs As FeatureSet = FeatureSet.Open(filename)