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;
The position of the column. Returns-1 if the column is not a member of a collection.
The OnPropertyChanged event occurs when the property value is successfully changed.
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)
DataColumn Class | DataColumn Members | System.Data Namespace