Język

DataGridView.Item[] Właściwość

Definicja

Udostępnia indeksator umożliwiający pobranie lub ustawienie komórki znajdującej się na przecięciu określonego wiersza i kolumny.

Przeciążenia

Nazwa Opis
Item[Int32, Int32]

Udostępnia indeksator umożliwiający pobranie lub ustawienie komórki znajdującej się na przecięciu kolumny i wiersza z określonymi indeksami.

Item[String, Int32]

Udostępnia indeksator do pobrania lub ustawienia komórki znajdującej się na przecięciu wiersza z określonym indeksem i kolumną o określonej nazwie.

Item[Int32, Int32]

Źródło:
DataGridView.cs
Źródło:
DataGridView.cs
Źródło:
DataGridView.cs
Źródło:
DataGridView.cs
Źródło:
DataGridView.cs

Udostępnia indeksator umożliwiający pobranie lub ustawienie komórki znajdującej się na przecięciu kolumny i wiersza z określonymi indeksami.

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

Indeks kolumny zawierającej komórkę.

rowIndex
Int32

Indeks wiersza zawierającego komórkę.

Wartość właściwości

Obiekt DataGridViewCell w określonej lokalizacji.

Atrybuty

Wyjątki

columnIndex wartość jest mniejsza niż 0 lub większa niż liczba kolumn w kontrolce minus 1.

— lub —

rowIndex jest mniejsza niż 0 lub większa niż liczba wierszy w kontrolce minus 1.

Przykłady

W poniższym przykładzie kodu pokazano użycie tego indeksatora.

// 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)

Uwagi

Ten indeksator jest alternatywą dla uzyskiwania dostępu do komórek za pośrednictwem Cells kolekcji kolekcji Rows .

Zobacz też

Dotyczy

Item[String, Int32]

Źródło:
DataGridView.cs
Źródło:
DataGridView.cs
Źródło:
DataGridView.cs
Źródło:
DataGridView.cs
Źródło:
DataGridView.cs

Udostępnia indeksator do pobrania lub ustawienia komórki znajdującej się na przecięciu wiersza z określonym indeksem i kolumną o określonej nazwie.

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

Nazwa kolumny zawierającej komórkę.

rowIndex
Int32

Indeks wiersza zawierającego komórkę.

Wartość właściwości

Obiekt DataGridViewCell w określonej lokalizacji.

Atrybuty

Przykłady

W poniższym przykładzie kodu pokazano użycie tego indeksatora.

// 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)

Uwagi

Ten indeksator jest alternatywą dla uzyskiwania dostępu do komórek za pośrednictwem Cells kolekcji kolekcji Rows .

Zobacz też

Dotyczy