Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

DataRowView.Row Property

Gets the DataRow being viewed.

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

Property Value

The DataRow being viewed by the DataRowView.

Example

[Visual Basic, C#, C++] The following example uses the Row property to print the value of the third column in each modified row of a DataView.

[Visual Basic] 
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] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

DataRowView Class | DataRowView Members | System.Data Namespace | DataRowView | DataRow

Show:
© 2015 Microsoft