NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

DataColumn.Ordinal

Gets the position of the column in the ColumnsCollection collection.

[Visual Basic]
Public ReadOnly Property Ordinal As Integer
[C#]
public int Ordinal {get;}
[C++]
public: __property int get_Ordinal();
[JScript]
public function get Ordinal() : int;

Property Value

The position of the column. Returns-1 if the column is not a member of a collection.

Remarks

The OnPropertyChanged event occurs when the property value is successfully changed.

Example

The following example returns the ordinal of a clicked column. The example uses the System.WinForms.DataGrid control to determine which column is clicked.

' Place this code in the Click event of a DataGrid control
' to return the ordinal of the clicked column.
Dim currCol As DataColumn
Dim myTable As DataTable
myTable = DataGrid1.DataGridTable.DataTable
currCol = myTable.Columns(DataGrid1.CurrentCell.ColumnNumber)
Console.WriteLine(currCol.Ordinal)

See Also

DataColumn Class | DataColumn Members | System.Data Namespace