AddNew Method

DataView.AddNew Method

Adds a new row to the DataView.

[Visual Basic]
Public Overridable Function AddNew() As DataRowView
public virtual DataRowView AddNew();
public: virtual DataRowView* AddNew();
public function AddNew() : DataRowView;

Return Value

A DataRowView.


[Visual Basic, C#, C++] The following example uses the AddNew method to return a new DataRowView that has been added to the DataTable.

[Visual Basic] 
Private Sub AddNewDataRowView(dv As DataView)
   Dim drv As DataRowView = dv.AddNew
   ' Change values in the DataRow.
   drv("ColumnName") = "New value"
End Sub

private void AddNewDataRowView(DataView dv)
   DataRowView drv = dv.AddNew();
   // Change values in the DataRow.
   drv["ColumnName"] = "New value";

 void AddNewDataRowView(DataView* dv)
    DataRowView* drv = dv->AddNew();
    // Change values in the DataRow.
    drv->Item[S"ColumnName"] = S"New value";

[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.


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

DataView Class | DataView Members | System.Data Namespace | AllowNew | DataRowView

© 2015 Microsoft