DataRowView.Row 屬性

定義

取得正在檢視的 DataRowGets the DataRow being viewed.

public:
 property System::Data::DataRow ^ Row { System::Data::DataRow ^ get(); };
public System.Data.DataRow Row { get; }
member this.Row : System.Data.DataRow
Public ReadOnly Property Row As DataRow

屬性值

DataRow

正在由 DataRow 檢視的 DataRowViewThe DataRow being viewed by the DataRowView.

範例

下列範例會使用 Row 屬性,在的每個修改過的資料列中列印第三個數據行的值 DataViewThe following example uses the Row property to print the value of the third column in each modified row of a DataView.

private void ShowColumn3()
{
    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)
    {
        Console.WriteLine(rowView.Row[2]);
    }
}
Private Sub ShowColumn3()
    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
        Console.WriteLine(rowView.Row(2))
    Next rowView
End Sub

適用於

另請參閱