vb.net arcobjects - show fieldname

المشرف العام

Administrator
طاقم الإدارة
Big hello to all,

can somebody help me please?I try to show the field names (alias names) of a feature class. I found code snippet but I don't succeed to get it to run :(Can somebody tell me please what is wrong in the code? (System: Arcgis 10.2, Visual Studio2012) Thanks a lot!!

Imports ESRI.ArcGIS.esriSystemImports ESRI.ArcGIS.CartoImports ESRI.ArcGIS.ArcMapUIImports ESRI.ArcGIS.GeodatabasePublic Class FieldNameButton Inherits ESRI.ArcGIS.Desktop.AddIns.Button Public Sub New() End Sub Protected Overrides Sub OnClick() ShowDistinctFieldAliasNames(My.ArcMap.Document) End Sub Shared Sub ShowDistinctFieldAliasNames(ByVal featureClass As IFeatureClass) ' Get the Fields collection from the feature class. Dim fields As IFields = featureClass.Fields Dim field As IField = Nothing ' On a zero-based index, iterate through the fields in the collection. For i As Integer = 0 To fields.FieldCount - 1 ' Get the field at the given index. field = fields.Field(i) If field.Name field.AliasName Then Console.WriteLine("{0} : {1}", field.Name, field.AliasName) MsgBox(field.AliasName) End If Next i My.ArcMap.Application.CurrentTool = Nothing End Sub Protected Overrides Sub OnUpdate() Enabled = My.ArcMap.Application IsNot Nothing End Sub Private Sub DisplayDistinctFieldAliasNames() Throw New NotImplementedException End SubEnd Class

أكثر...
 
أعلى