DataGridCell DataGridCell DataGridCell DataGridCell Struct

Definição

Identifica uma célula na grade.Identifies a cell in the grid.

public value class DataGridCell
public struct DataGridCell
type DataGridCell = struct
Public Structure DataGridCell
Herança
DataGridCellDataGridCellDataGridCellDataGridCell

Exemplos

O exemplo a seguir atribui o DataGridCell CurrentCell ao de System.Windows.Forms.DataGrid a e retorna o número de coluna e linha da célula selecionada.The 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. O DataTable valor armazenado no também é impresso usando o DataGridCell objeto RowNumber e ColumnNumber.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

Comentários

O DataGridCell pode ser usado em conjunto com a System.Windows.Forms.DataGrid Propriedade do CurrentCell controle para obter ou definir o valor de qualquer célula.The 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. Definir a System.Windows.Forms.DataGrid Propriedade do CurrentCell controle como um DataGridCell faz com que o foco seja movido para a célula especificada DataGridCellpelo.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.

Construtores

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

Inicializa uma nova instância da classe DataGridCell.Initializes a new instance of the DataGridCell class.

Propriedades

ColumnNumber ColumnNumber ColumnNumber ColumnNumber

Obtém ou define o número de uma coluna no controle DataGrid.Gets or sets the number of a column in the DataGrid control.

RowNumber RowNumber RowNumber RowNumber

Obtém ou define o número de uma linha no controle DataGrid.Gets or sets the number of a row in the DataGrid control.

Métodos

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

Obtém um valor que indica se o DataGridCell é idêntico a um segundo DataGridCell.Gets a value indicating whether the DataGridCell is identical to a second DataGridCell.

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

Obtém um valor de hash que pode ser adicionado a um Hashtable.Gets a hash value that can be added to a Hashtable.

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

Obtém o número da linha e o número da coluna da célula.Gets the row number and column number of the cell.

Aplica-se a

Veja também