DataGridCell Estrutura
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Identifica uma célula na grelha.
public value class DataGridCell
public struct DataGridCell
type DataGridCell = struct
Public Structure DataGridCell
- Herança
Exemplos
O exemplo seguinte atribui o DataGridCell ao CurrentCell de um System.Windows.Forms.DataGrid e devolve o número da coluna e da linha da célula selecionada. O valor armazenado em é DataTable também impresso usando os DataGridCell objetos RowNumber e 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
Observações
O
Construtores
| Name | Description |
|---|---|
| DataGridCell(Int32, Int32) |
Inicializa uma nova instância da DataGridCell classe. |
Propriedades
| Name | Description |
|---|---|
| ColumnNumber |
Obtém ou define o número de uma coluna no DataGrid controlo. |
| RowNumber |
Obtém ou define o número de uma linha no DataGrid controlo. |
Métodos
| Name | Description |
|---|---|
| Equals(Object) |
Obtém um valor que indica se o DataGridCell é idêntico a um segundo DataGridCell. |
| GetHashCode() |
Obtém um valor de hash que pode ser adicionado a um Hashtable. |
| ToString() |
Obtém o número da linha e o número da coluna da célula. |