ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / TableView Class / GetFieldIndex Method
The name of the field.
Example

In This Topic
    GetFieldIndex Method (TableView)
    In This Topic
    Gets the index of the field with the given name.
    Syntax
    public int GetFieldIndex( 
       string fieldName
    )
    Public Function GetFieldIndex( _
       ByVal fieldName As String _
    ) As Integer

    Parameters

    fieldName
    The name of the field.

    Return Value

    The index of the field. -1 is returned if the field name is not found.
    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);
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.1 or higher.
    See Also