DataGridView.Item[] プロパティ

定義

指定した行と列の積集合にあるセルを取得または設定するインデクサーを提供します。

オーバーロード

名前 説明
Item[Int32, Int32]

列と行と指定したインデックスの積集合にあるセルを取得または設定するインデクサーを提供します。

Item[String, Int32]

指定したインデックスと指定した名前の列との交差部分にあるセルを取得または設定するインデクサーを提供します。

Item[Int32, Int32]

ソース:
DataGridView.cs
ソース:
DataGridView.cs
ソース:
DataGridView.cs
ソース:
DataGridView.cs
ソース:
DataGridView.cs

列と行と指定したインデックスの積集合にあるセルを取得または設定するインデクサーを提供します。

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

パラメーター

columnIndex
Int32

セルを含む列のインデックス。

rowIndex
Int32

セルを含む行のインデックス。

プロパティ値

指定した場所にある DataGridViewCell

属性

例外

columnIndex が 0 未満か、コントロール内の列の数から 1 を引いた値より大きい。

-又は-

rowIndex が 0 未満か、コントロール内の行数から 1 を引いた数を超える値です。

次のコード例は、このインデクサーの使用方法を示しています。

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

注釈

このインデクサーは、Cells コレクションのRows コレクションを介してセルにアクセスする代わりに使用します。

こちらもご覧ください

適用対象

Item[String, Int32]

ソース:
DataGridView.cs
ソース:
DataGridView.cs
ソース:
DataGridView.cs
ソース:
DataGridView.cs
ソース:
DataGridView.cs

指定したインデックスと指定した名前の列との交差部分にあるセルを取得または設定するインデクサーを提供します。

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

パラメーター

columnName
String

セルを含む列の名前。

rowIndex
Int32

セルを含む行のインデックス。

プロパティ値

指定した場所にある DataGridViewCell

属性

次のコード例は、このインデクサーの使用方法を示しています。

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

注釈

このインデクサーは、Cells コレクションのRows コレクションを介してセルにアクセスする代わりに使用します。

こちらもご覧ください

適用対象