次の方法で共有


DataRowView.Row プロパティ

表示されている DataRow を取得します。

Public ReadOnly Property Row As DataRow
[C#]
public DataRow Row {get;}
[C++]
public: __property DataRow* get_Row();
[JScript]
public function get Row() : DataRow;

プロパティ値

DataRowView に表示されている DataRow

使用例

[Visual Basic, C#, C++] Row プロパティを使用して、 DataView の変更した各行の 3 番目の列の値を出力する例を次に示します。

 
Private Sub ShowColumn3()
    Dim dv As DataView = CType(dataGrid1.DataSource, DataView)
    ' Set the filter to display only those rows that were modified.
    dv.RowStateFilter = DataViewRowState.ModifiedCurrent
    ' Change the value of the CompanyName column for each modified row.
    Dim drv As DataRowView
    For Each drv In  dv
        Console.WriteLine(drv.Row(2))
    Next drv
End Sub

[C#] 
private void ShowColumn3() {
   DataView dv = (DataView) dataGrid1.DataSource;
   // Set the filter to display only those rows that were modified.
   dv.RowStateFilter=DataViewRowState.ModifiedCurrent;
   // Change the value of the CompanyName column for each modified row.
   foreach(DataRowView drv in dv){
      Console.WriteLine(drv.Row[2]);
   }
}

[C++] 
private:
 void ShowColumn3() {
    DataView* dv = dynamic_cast<DataView*> (dataGrid1->DataSource);
    // Set the filter to display only those rows that were modified.
    dv->RowStateFilter=DataViewRowState::ModifiedCurrent;
    // Change the value of the CompanyName column for each modified row.
    System::Collections::IEnumerator* myEnum = dv->GetEnumerator();
    while (myEnum->MoveNext())
    {
       DataRowView* drv = __try_cast<DataRowView*>(myEnum->Current);
       Console::WriteLine(drv->Row->Item[2]);
    }
 }

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET

参照

DataRowView クラス | DataRowView メンバ | System.Data 名前空間 | DataRowView | DataRow