Returns the index position of the Column, given the specified column name.

Namespace:  ESRI.ArcGISExplorer.Data

Assembly:  ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)

Syntax

C#
public int FindColumn(
	string columnName
)
Visual Basic (Declaration)
Public Function FindColumn ( _
	columnName As String _
) As Integer

Parameters

columnName
Type: System..::.String

The name of the Column.

Return Value

An integer representing index position of the Column. If the column cannot be found a value of -1 will be returned.

Examples

The code below shows different approaches to finding the index position of a column within a Table and how to return Column objects. The first example uses the FindColumn method to return the index of the Name column.
CopyC#
//Open a file geodatabase feature class called mountains
Table mountainsTable = Table.OpenFileGeodatabaseTable(@"C:\Data\Scotland.gdb", "mountains");

//Example 1 - return the index position of the Name column
int nameColPosition = mountainsTable.Columns.FindColumn("Name");
System.Diagnostics.Debug.Print(nameColPosition.ToString()); //Prints "2"
//Get the Name column
Column nameColumn = mountainsTable.Columns[nameColPosition];

//Example 2 - return the index position of the Name column using the column alias name
nameColPosition = mountainsTable.Columns.FindColumnByAliasName("Name");
System.Diagnostics.Debug.Print(nameColPosition.ToString()); //Prints "2"
//Get the Name column
nameColumn = mountainsTable.Columns[nameColPosition];

//Example 3 - return the Name column directly by column name
nameColumn = mountainsTable.Columns["Name"];
CopyVB.NET
'Open a file geodatabase feature class called mountains
Dim mountainsTable As Table = Table.OpenFileGeodatabaseTable("C:\Data\Scotland.gdb", "mountains")

'Example 1 - return the index position of the Name column
Dim nameColPosition As Integer = mountainsTable.Columns.FindColumn("Name")
System.Diagnostics.Debug.Print(nameColPosition.ToString())  'Prints "2"
'Get the name column using index
Dim nameColumn As Column = mountainsTable.Columns.Item(nameColPosition)

'Example 2 - return the index position of the Name column using the column alias name
nameColPosition = mountainsTable.Columns.FindColumnByAliasName("Mountain Name")
System.Diagnostics.Debug.Print(nameColPosition.ToString()) 'Prints "2"
'Get the name column using index
nameColumn = mountainsTable.Columns.Item(nameColPosition)

'Example 3 - return the Name column directly by column name
nameColumn = mountainsTable.Columns.Item("Name")

See Also