DataRowView.Item[] 속성

정의

지정된 열에 있는 값을 가져오거나 설정합니다.

오버로드

Item[Int32]

지정된 열에 있는 값을 가져오거나 설정합니다.

Item[String]

지정된 열에 있는 값을 가져오거나 설정합니다.

Item[Int32]

Source:
DataRowView.cs
Source:
DataRowView.cs
Source:
DataRowView.cs

지정된 열에 있는 값을 가져오거나 설정합니다.

public:
 property System::Object ^ default[int] { System::Object ^ get(int ndx); void set(int ndx, System::Object ^ value); };
public object this[int ndx] { get; set; }
member this.Item(int) : obj with get, set
Default Public Property Item(ndx As Integer) As Object

매개 변수

ndx
Int32

열 인덱스입니다.

속성 값

열의 값입니다.

예외

DataView에서는 편집을 허용하지 않으며 DataRowView가 신규가 아닙니다.

해당 인덱스 값에 일치하는 열이 없습니다.

예제

다음 예제에서는 의 각 DataRowView 항목에 값을 표시 합니다 DataView.

private static void WriteViewRows(DataView view)
{
    int colCount = view.Table.Columns.Count;

    // Iterate through the rows of the DataView.
    foreach (DataRowView rowView in view)
    {
        // Display the value in each item of the DataRowView
        for (int i = 0; i < colCount; i++)
            Console.Write(rowView[i] + "\table");
        Console.WriteLine();
    }
}

Private Shared Sub WriteViewRows(view As DataView)
   Dim colCount As Integer = view.Table.Columns.Count

   ' Iterate through the rows of the DataView.
   For Each rowView As DataRowView In view
     ' Display the value in each item of the DataRowView
     For i As Integer = 0 To colCount - 1
        Console.Write(rowView(i) & vbTab)
     Next
     Console.WriteLine()
   Next
End Sub

적용 대상

Item[String]

Source:
DataRowView.cs
Source:
DataRowView.cs
Source:
DataRowView.cs

지정된 열에 있는 값을 가져오거나 설정합니다.

public:
 property System::Object ^ default[System::String ^] { System::Object ^ get(System::String ^ property); void set(System::String ^ property, System::Object ^ value); };
public object this[string property] { get; set; }
member this.Item(string) : obj with get, set
Default Public Property Item(property As String) As Object

매개 변수

property
String

지정된 열이 있는 문자열입니다.

속성 값

열의 값입니다.

예외

지정된 이름 또는 관계의 열을 찾을 수 없습니다.

또는

DataView에서는 편집을 허용하지 않으며 DataRowView가 신규가 아닙니다.

값을 설정할 때 property이(가) 일치하지 않습니다.

예제

다음 예제에서는 의 수정된 각 행에 있는 열 값에 텍스트를 추가합니다 DataView.

private void SetDataRowView()
{
    DataView view = (DataView) dataGrid1.DataSource;

    // Set the filter to display only those rows that were modified.
    view.RowStateFilter=DataViewRowState.ModifiedCurrent;

    // Change the value of the CompanyName column for each modified row.
    foreach(DataRowView rowView in view)
    {
        rowView["CompanyName"] += " new value";
    }
}
Private Sub SetDataRowView()
     Dim view As DataView = CType(dataGrid1.DataSource, DataView)

     ' Set the filter to display only those rows that were modified.
     view.RowStateFilter = DataViewRowState.ModifiedCurrent

     ' Change the value of the CompanyName column for each modified row.
     Dim rowView As DataRowView
     For Each rowView In  view
         rowView.Item("CompanyName") = _
         rowView.Item("CompanyName").ToString() & " new value"
     Next rowView
End Sub

적용 대상