I want to get all field names present in a feature class using queryfilter programmatically.
-
1What methods have you tried, how far did you get, and where specifically do you need help?– whuberCommented Aug 13, 2012 at 14:05
-
1Thanks whuber.....i used query filter to get selected field names.....pQueryFilter.SubFields = "city_population,city_id"....but i want all the field names without passing them within quotes( " ")....any help !– NavishCommented Aug 14, 2012 at 3:53
-
1Presumably this is for ArcGIS, right? (It's a good idea to put these details in the question itself.)– whuberCommented Aug 14, 2012 at 11:55
-
Yes,featureclasses are stored in a pgdb....– NavishCommented Aug 16, 2012 at 3:39
-
If you want all fields, just specify "*" as the IQueryFilter.SubFields property. Otherwise, you can access the list of fields through IFeatureClass.Fields.– Petr KrebsCommented Aug 16, 2012 at 20:31
|
Show 1 more comment
1 Answer
ESRI has excellent documentation for everything. With a quick search you would most probably get what you want. Below snippet is slightly modified version copied from there
Public Sub DisplayDistinctFieldAliasNames(ByVal featureClass As IFeatureClass)
Dim fields As IFields = featureClass.Fields
Dim field As IField = Nothing
For i As Integer = 0 To fields.FieldCount - 1
field = fields.Field(i)
Console.WriteLine(field.Name)
Next i
End Sub
-
5"ESRI has excellent documentation for everything" -- not sure if serious.– blah238Commented Aug 16, 2012 at 18:33
-