Sdílet prostřednictvím


DataGridCell Struktura

Definice

Upozornění

DataGrid is provided for binary compatibility with .NET Framework and is not intended to be used directly from your code. Use DataGridView instead.

Identifikuje buňku v mřížce.

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
Dědičnost
DataGridCell
Atributy

Příklady

Následující příklad přiřadí DataGridCell k CurrentCell a System.Windows.Forms.DataGrid vrátí sloupec a číslo řádku vybrané buňky. Hodnota uložená v objektu DataTable je také vytištěna pomocí objektu DataGridCellRowNumber a 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

Poznámky

Lze DataGridCell použít ve spojení s System.Windows.Forms.DataGrid vlastností ovládacího prvku CurrentCell získat nebo nastavit hodnotu libovolné buňky. System.Windows.Forms.DataGrid Nastavení vlastnosti ovládacího prvku CurrentCell na hodnotu DataGridCell způsobí, že se fokus přesune na buňku určenou objektem DataGridCell.

Konstruktory

Name Description
DataGridCell(Int32, Int32)
Zastaralé.

Inicializuje novou instanci DataGridCell třídy.

Vlastnosti

Name Description
ColumnNumber
Zastaralé.

Získá nebo nastaví počet sloupců v ovládacím DataGrid prvku.

RowNumber
Zastaralé.

Získá nebo nastaví počet řádků v ovládacím DataGrid prvku.

Metody

Name Description
Equals(Object)
Zastaralé.

Získá hodnotu určující, zda DataGridCell je identický s druhým DataGridCell.

GetHashCode()
Zastaralé.

Získá hodnotu hash, kterou lze přidat do Hashtable.

ToString()
Zastaralé.

Získá číslo řádku a číslo sloupce buňky.

Platí pro

Viz také