ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / TableView Class / GetField Method
The display index of the field.
Example

In This Topic
    GetField Method (TableView)
    In This Topic
    Gets the field at the given index.
    Syntax
    public FieldDescription GetField( 
       int index
    )
    Public Function GetField( _
       ByVal index As Integer _
    ) As FieldDescription

    Parameters

    index
    The display index of the field.

    Return Value

    The FieldDescription at the index.
    Example
    Field Access
    var tv = TableView.Active;
    if (tv == null)
      return;
    
    // field access
    var flds = tv.GetFields();
    var fldIdx = tv.GetFieldIndex("STATE_NAME");
    var fldDesc = tv.GetField(fldIdx);
    
    Get or set the Active Field
    var tv = TableView.Active;
    if (tv == null)
      return;
    
    // get active field, active field name
    var activeFieldIdx = tv.ActiveFieldIndex;
    var fldDesc = tv.GetField(activeFieldIdx);
    var fldName = fldDesc.Name;
    
    // set active field by name
    tv.SetActiveField("STATE_NAME");
    
    // or set active field by index
    tv.SetActiveField(3);
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.1 or higher.
    See Also