1

I want to get all field names present in a feature class using queryfilter programmatically.

6
  • 1
    What methods have you tried, how far did you get, and where specifically do you need help?
    – whuber
    Commented Aug 13, 2012 at 14:05
  • 1
    Thanks 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 !
    – Navish
    Commented Aug 14, 2012 at 3:53
  • 1
    Presumably this is for ArcGIS, right? (It's a good idea to put these details in the question itself.)
    – whuber
    Commented Aug 14, 2012 at 11:55
  • Yes,featureclasses are stored in a pgdb....
    – Navish
    Commented 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 Krebs
    Commented Aug 16, 2012 at 20:31

1 Answer 1

5

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
2
  • 5
    "ESRI has excellent documentation for everything" -- not sure if serious.
    – blah238
    Commented Aug 16, 2012 at 18:33
  • @blah238 - at least for the desktop SDK, its god :-)
    – vinayan
    Commented Aug 17, 2012 at 0:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.