ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / TableView Class / ActiveFieldIndex Property
Example

In This Topic
    ActiveFieldIndex Property (TableView)
    In This Topic
    Gets the zero based index of the active field in the table. Can be -1 if there are no fields.
    Syntax
    public int ActiveFieldIndex {get;}
    Public ReadOnly Property ActiveFieldIndex As Integer
    Example
    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