DataGridCell DataGridCell DataGridCell DataGridCell Struct

Definición

Identifica una celda de la cuadrícula.Identifies a cell in the grid.

public value class DataGridCell
public struct DataGridCell
type DataGridCell = struct
Public Structure DataGridCell
Herencia
DataGridCellDataGridCellDataGridCellDataGridCell

Ejemplos

En el ejemplo siguiente se asigna System.Windows.Forms.DataGrid adeysedevuelveelnúmerodecolumnaydefiladelaceldaseleccionada.CurrentCell DataGridCellThe following example assigns the DataGridCell to the CurrentCell of a System.Windows.Forms.DataGrid and returns the column and row number of the selected cell. El valor DataTable almacenado en también se imprime utilizando el RowNumber y DataGridCell ColumnNumberel objeto.The value stored in the DataTable is also printed using the DataGridCell object's RowNumber and ColumnNumber.

void PrintCellRowAndCol()
{
   DataGridCell^ myCell;
   myCell = DataGrid1->CurrentCell;
   Console::WriteLine( myCell->RowNumber );
   Console::WriteLine( myCell->ColumnNumber );
   
   // Prints the value of the cell through the DataTable.
   DataTable^ myTable;
   
   // Assumes the DataGrid is bound to a DataTable.
   myTable = dynamic_cast<DataTable^>(DataGrid1->DataSource);
   Console::WriteLine( myTable->Rows[ myCell->RowNumber ][ myCell->ColumnNumber ] );
}

private void PrintCellRowAndCol()
{
   DataGridCell myCell;
   myCell = DataGrid1.CurrentCell;
   Console.WriteLine(myCell.RowNumber);
   Console.WriteLine(myCell.ColumnNumber);
   // Prints the value of the cell through the DataTable.
   DataTable myTable;
   // Assumes the DataGrid is bound to a DataTable.
   myTable = (DataTable) DataGrid1.DataSource;
   Console.WriteLine(myTable.Rows[myCell.RowNumber]
   [myCell.ColumnNumber]);
}

Private Sub PrintCellRowAndCol()
    Dim myCell As DataGridCell
    myCell = DataGrid1.CurrentCell
    Console.WriteLine(myCell.RowNumber)
    Console.WriteLine(myCell.ColumnNumber)
    ' Prints the value of the cell through the DataTable.
    Dim myTable As DataTable
    ' Assumes the DataGrid is bound to a DataTable.
    myTable = CType(DataGrid1.DataSource, DataTable)
    Console.WriteLine(myTable.Rows(myCell.RowNumber)(myCell.ColumnNumber))
 End Sub

Comentarios

Se puede usar junto con la System.Windows.Forms.DataGrid propiedad del CurrentCell control para obtener o establecer el valor de cualquier celda. DataGridCellThe DataGridCell can be used in conjunction with the System.Windows.Forms.DataGrid control's CurrentCell property to get or set the value of any cell. Establecer la System.Windows.Forms.DataGrid propiedad del CurrentCell control en un DataGridCell hace que el foco DataGridCellse mueva a la celda especificada por.Setting the System.Windows.Forms.DataGrid control's CurrentCell property to a DataGridCell causes the focus to move to the cell specified by the DataGridCell.

Constructores

DataGridCell(Int32, Int32) DataGridCell(Int32, Int32) DataGridCell(Int32, Int32) DataGridCell(Int32, Int32)

Inicializa una nueva instancia de la clase DataGridCell.Initializes a new instance of the DataGridCell class.

Propiedades

ColumnNumber ColumnNumber ColumnNumber ColumnNumber

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

RowNumber RowNumber RowNumber RowNumber

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

Métodos

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Obtiene un valor que indica si DataGridCell es idéntico a un segundo DataGridCell.Gets a value indicating whether the DataGridCell is identical to a second DataGridCell.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Obtiene un valor hash que puede agregarse a un Hashtable.Gets a hash value that can be added to a Hashtable.

ToString() ToString() ToString() ToString()

Obtiene el número de fila y el número de columna de la celda.Gets the row number and column number of the cell.

Se aplica a

Consulte también: