DataGridCell Structure
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Attention
DataGrid is provided for binary compatibility with .NET Framework and is not intended to be used directly from your code. Use DataGridView instead.
Identifie une cellule dans la grille.
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
- Héritage
- Attributs
Exemples
L’exemple suivant affecte la DataGridCellCurrentCell valeur d’un System.Windows.Forms.DataGrid élément et retourne le numéro de colonne et de ligne de la cellule sélectionnée. La valeur stockée dans le fichier DataTable est également imprimée à l’aide DataGridCell des objets RowNumber et 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
Remarques
Il DataGridCell peut être utilisé conjointement avec la System.Windows.Forms.DataGrid propriété du CurrentCell contrôle pour obtenir ou définir la valeur de n’importe quelle cellule. La définition de la propriété du CurrentCell contrôle sur une DataGridCell cause de déplacement du focus vers la cellule spécifiée par le DataGridCell.System.Windows.Forms.DataGrid
Constructeurs
| Nom | Description |
|---|---|
| DataGridCell(Int32, Int32) |
Obsolète.
Initialise une nouvelle instance de la classe DataGridCell. |
Propriétés
| Nom | Description |
|---|---|
| ColumnNumber |
Obsolète.
Obtient ou définit le nombre d’une colonne dans le DataGrid contrôle. |
| RowNumber |
Obsolète.
Obtient ou définit le nombre d’une ligne dans le DataGrid contrôle. |
Méthodes
| Nom | Description |
|---|---|
| Equals(Object) |
Obsolète.
Obtient une valeur indiquant si la valeur DataGridCell est identique à une seconde DataGridCell. |
| GetHashCode() |
Obsolète.
Obtient une valeur de hachage qui peut être ajoutée à un Hashtable. |
| ToString() |
Obsolète.
Obtient le numéro de ligne et le numéro de colonne de la cellule. |