DataGridCell Estructura
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Precaución
DataGrid is provided for binary compatibility with .NET Framework and is not intended to be used directly from your code. Use DataGridView instead.
Identifica una celda de la cuadrícula.
public value class DataGridCell
public struct DataGridCell
[System.ComponentModel.Browsable(false)]
[System.Obsolete("`DataGrid` is provided for binary compatibility with .NET Framework and is not intended to be used directly from your code. Use `DataGridView` instead.", false, DiagnosticId="WFDEV006", UrlFormat="https://aka.ms/winforms-warnings/{0}")]
public struct DataGridCell
type DataGridCell = struct
[<System.ComponentModel.Browsable(false)>]
[<System.Obsolete("`DataGrid` is provided for binary compatibility with .NET Framework and is not intended to be used directly from your code. Use `DataGridView` instead.", false, DiagnosticId="WFDEV006", UrlFormat="https://aka.ms/winforms-warnings/{0}")>]
type DataGridCell = struct
Public Structure DataGridCell
- Herencia
- Atributos
Ejemplos
En el ejemplo siguiente se asigna al DataGridCellCurrentCell de System.Windows.Forms.DataGrid y se devuelve la columna y el número de fila de la celda seleccionada. El valor almacenado en DataTable también se imprime mediante el DataGridCell objeto RowNumber y 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
DataGridCell se puede usar junto con la System.Windows.Forms.DataGrid propiedad del CurrentCell control para obtener o establecer el valor de cualquier celda. Al establecer la System.Windows.Forms.DataGrid propiedad del CurrentCell control en , DataGridCell el foco se mueve a la celda especificada por .DataGridCell
Constructores
| Nombre | Description |
|---|---|
| DataGridCell(Int32, Int32) |
Obsoletos.
Inicializa una nueva instancia de la clase DataGridCell. |
Propiedades
| Nombre | Description |
|---|---|
| ColumnNumber |
Obsoletos.
Obtiene o establece el número de una columna del DataGrid control . |
| RowNumber |
Obsoletos.
Obtiene o establece el número de una fila en el DataGrid control . |
Métodos
| Nombre | Description |
|---|---|
| Equals(Object) |
Obsoletos.
Obtiene un valor que indica si DataGridCell es idéntico a un segundo DataGridCell. |
| GetHashCode() |
Obsoletos.
Obtiene un valor hash que se puede agregar a .Hashtable |
| ToString() |
Obsoletos.
Obtiene el número de fila y el número de columna de la celda. |