How to get featureclasses from a geodatabase(.gdb)?

499
2
08-04-2010 07:28 AM
Chandan_KumarRath
New Contributor
I have successfully opened a geodatabase using propertyset. the code is as given below:
        public IWorkspace FileGdbWorkspaceFromPropertySet(string database)
        {
            try
            {
                IPropertySet propertySet = new PropertySetClass();
                propertySet.SetProperty("DATABASE", database);
                IWorkspaceFactory workspaceFactory = new FileGDBWorkspaceFactoryClass();
                return workspaceFactory.Open(propertySet, 0);
            }
            catch (System.Runtime.InteropServices.COMException Exp)
            {
                MessageBox.Show(Exp.Message + "\n" + Exp.StackTrace);
                return null;
            }
        }


Now I need to populate a listbox with the name of all the featureclasses present inside the geodatabase.
Please help me to solve this....

Thanks.....!
0 Kudos
2 Replies
ThavitinaiduGulivindala
Occasional Contributor
Hi,
You can make use of DatasetNames property on IWorkspace to get the all the Stand alone feature classes. In order to get feature classes inside the Feature Datasets, make use of DatasetNames property on IWorkspace to get feature datasets and then FeatureClassNames property on IFeatureDatasetName interface.

http://edndoc.esri.com/arcobjects/9.2/ComponentHelp/esrigeodatabase/IWorkspace_DatasetNames.htm

Cheers,
Thaviti
0 Kudos
Chandan_KumarRath
New Contributor
It works....

Thank you very much thaviti....
0 Kudos