DataGridView.Item[] 속성

정의

지정한 행과 열의 교집합에 있는 셀을 얻거나 설정하는 인덱서입니다.

오버로드

Name Description
Item[Int32, Int32]

지정한 인덱스를 사용하여 열과 행의 교차점에 있는 셀을 얻거나 설정하는 인덱서입니다.

Item[String, Int32]

행의 교집합에 있는 셀을 지정한 인덱스와 지정한 이름의 열로 설정하거나 가져올 인덱서입니다.

Item[Int32, Int32]

Source:
DataGridView.cs
Source:
DataGridView.cs
Source:
DataGridView.cs
Source:
DataGridView.cs
Source:
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]

Source:
DataGridView.cs
Source:
DataGridView.cs
Source:
DataGridView.cs
Source:
DataGridView.cs
Source:
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 .

추가 정보

적용 대상