DataGridCell.ColumnNumber DataGridCell.ColumnNumber DataGridCell.ColumnNumber DataGridCell.ColumnNumber Property

Definición

Obtiene o establece el número de una columna del control DataGrid.Gets or sets the number of a column in the DataGrid control.

public:
 property int ColumnNumber { int get(); void set(int value); };
public int ColumnNumber { get; set; }
member this.ColumnNumber : int with get, set
Public Property ColumnNumber As Integer

Valor de propiedad

Número de la columna.The number of the column.

Ejemplos

En el ejemplo siguiente se asigna la CurrentCell propiedad de un System.Windows.Forms.DataGrid a un DataGridCell.The following example assigns the CurrentCell property of a System.Windows.Forms.DataGrid to a DataGridCell. DataTable El valor almacenado en se devuelve DataRow especificando los objetos y DataColumn a través de RowNumber las ColumnNumber propiedades y.The value stored in the DataTable is returned by specifying DataRow and DataColumn objects through the RowNumber and ColumnNumber properties.

void PrintCell( Object^ sender, MouseEventArgs^ /*e*/ )
{
   DataGrid^ thisGrid = dynamic_cast<DataGrid^>(sender);
   DataGridCell myDataGridCell = thisGrid->CurrentCell;
   BindingManagerBase^ bm = BindingContext[ thisGrid->DataSource,thisGrid->DataMember ];
   DataRowView^ drv = dynamic_cast<DataRowView^>(bm->Current);
   Console::WriteLine( drv[ myDataGridCell.ColumnNumber ] );
   Console::WriteLine( myDataGridCell.RowNumber );
}

private void PrintCell(object sender, MouseEventArgs e)
{
   DataGrid thisGrid = (DataGrid) sender;
   DataGridCell myDataGridCell = thisGrid.CurrentCell;
   BindingManagerBase bm = BindingContext[thisGrid.DataSource, thisGrid.DataMember];
   DataRowView drv = (DataRowView) bm.Current;
   Console.WriteLine(drv [myDataGridCell.ColumnNumber]);
   Console.WriteLine(myDataGridCell.RowNumber);
}

Private Sub PrintCell(sender As Object, e As MouseEventArgs)
   Dim thisGrid As DataGrid = CType(sender, DataGrid)
   Dim myDataGridCell As DataGridCell = thisGrid.CurrentCell
   Dim bm As BindingManagerBase = _
   BindingContext (thisGrid.DataSource, thisGrid.DataMember)
   Dim drv As DataRowView = CType(bm.Current, DataRowView)
   Console.WriteLine(drv(myDataGridCell.ColumnNumber))
   Console.WriteLine(myDataGridCell.RowNumber)
End Sub

Comentarios

Puede utilizar el ColumnNumber valor para especificar un DataColumn System.Windows.Forms.DataGrid en el DataTable asociado al control.You can use the ColumnNumber value to specify a DataColumn in the DataTable associated with the System.Windows.Forms.DataGrid control.

Se aplica a

Consulte también: