DataGridView.Item[] 속성

정의

지정된 행 및 열이 교차하는 지점에 있는 셀을 가져오거나 설정하기 위한 인덱서를 제공합니다.

오버로드

Item[Int32, Int32]

지정된 인덱스의 행 및 열이 교차하는 지점에 있는 셀을 가져오거나 설정하기 위한 인덱서를 제공합니다.

Item[String, Int32]

지정된 인덱스의 행과 지정된 이름의 열이 교차하는 지점에 있는 셀을 가져오거나 설정하기 위한 인덱서를 제공합니다.

Item[Int32, Int32]

지정된 인덱스의 행 및 열이 교차하는 지점에 있는 셀을 가져오거나 설정하기 위한 인덱서를 제공합니다.

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

지정된 위치의 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]

지정된 인덱스의 행과 지정된 이름의 열이 교차하는 지점에 있는 셀을 가져오거나 설정하기 위한 인덱서를 제공합니다.

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

지정된 위치의 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 있습니다.

추가 정보

적용 대상