DataGridView.Item[] Vlastnost

Definice

Poskytuje indexer pro získání nebo nastavení buňky umístěné v průsečíku zadaného řádku a sloupce.

Přetížení

Item[Int32, Int32]

Poskytuje indexer pro získání nebo nastavení buňky umístěné v průsečíku sloupce a řádku se zadanými indexy.

Item[String, Int32]

Poskytuje indexer pro získání nebo nastavení buňky umístěné v průsečíku řádku se zadaným indexem a sloupcem se zadaným názvem.

Item[Int32, Int32]

Poskytuje indexer pro získání nebo nastavení buňky umístěné v průsečíku sloupce a řádku se zadanými indexy.

public:
 property System::Windows::Forms::DataGridViewCell ^ default[int, int] { System::Windows::Forms::DataGridViewCell ^ get(int columnIndex, int rowIndex); void set(int columnIndex, int rowIndex, System::Windows::Forms::DataGridViewCell ^ value); };
[System.ComponentModel.Browsable(false)]
public System.Windows.Forms.DataGridViewCell this[int columnIndex, int rowIndex] { get; set; }
[<System.ComponentModel.Browsable(false)>]
member this.Item(int * int) : System.Windows.Forms.DataGridViewCell with get, set
Default Public Property Item(columnIndex As Integer, rowIndex As Integer) As DataGridViewCell

Parametry

columnIndex
Int32

Index sloupce obsahujícího buňku

rowIndex
Int32

Index řádku obsahujícího buňku

Hodnota vlastnosti

DataGridViewCell

V DataGridViewCell zadaném umístění.

Atributy

Výjimky

columnIndex je menší než 0 nebo větší než počet sloupců v ovládacím prvku minus 1.

-nebo- rowIndex je menší než 0 nebo větší než počet řádků v ovládacím prvku minus 1.

Příklady

Následující příklad kódu ukazuje použití tohoto indexeru.

// Retrieve the cell value for the cell at column 3, row 7.
String testValue1 = (String)dataGridView1[3, 7].Value;

// Retrieve the cell value for the cell in the Name column at row 4.
String testValue2 = (String)dataGridView1["Name", 4].Value;
' Retrieve the cell value for the cell at column 3, row 7.
Dim testValue1 As String = CStr(dataGridView1(3, 7).Value)

' Retrieve the cell value for the cell in the Name column at row 4.
Dim testValue2 As String = CStr(dataGridView1("Name", 4).Value)

Poznámky

Tento indexer je alternativou pro přístup k buňkám prostřednictvím Cells kolekce Rows kolekce.

Viz také

Platí pro

Item[String, Int32]

Poskytuje indexer pro získání nebo nastavení buňky umístěné v průsečíku řádku se zadaným indexem a sloupcem se zadaným názvem.

public:
 property System::Windows::Forms::DataGridViewCell ^ default[System::String ^, int] { System::Windows::Forms::DataGridViewCell ^ get(System::String ^ columnName, int rowIndex); void set(System::String ^ columnName, int rowIndex, System::Windows::Forms::DataGridViewCell ^ value); };
[System.ComponentModel.Browsable(false)]
public System.Windows.Forms.DataGridViewCell this[string columnName, int rowIndex] { get; set; }
[<System.ComponentModel.Browsable(false)>]
member this.Item(string * int) : System.Windows.Forms.DataGridViewCell with get, set
Default Public Property Item(columnName As String, rowIndex As Integer) As DataGridViewCell

Parametry

columnName
String

Název sloupce obsahujícího buňku

rowIndex
Int32

Index řádku obsahujícího buňku

Hodnota vlastnosti

DataGridViewCell

V DataGridViewCell zadaném umístění.

Atributy

Příklady

Následující příklad kódu ukazuje použití tohoto indexeru.

// Retrieve the cell value for the cell at column 3, row 7.
String testValue1 = (String)dataGridView1[3, 7].Value;

// Retrieve the cell value for the cell in the Name column at row 4.
String testValue2 = (String)dataGridView1["Name", 4].Value;
' Retrieve the cell value for the cell at column 3, row 7.
Dim testValue1 As String = CStr(dataGridView1(3, 7).Value)

' Retrieve the cell value for the cell in the Name column at row 4.
Dim testValue2 As String = CStr(dataGridView1("Name", 4).Value)

Poznámky

Tento indexer je alternativou pro přístup k buňkám prostřednictvím Cells kolekce Rows kolekce.

Viz také

Platí pro