The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
This topic has not yet been rated - Rate this topic

DataView.AllowNew Property

Gets or sets a value indicating whether the new rows can be added using the AddNew method.

[Visual Basic]
Public Property AllowNew As Boolean
public bool AllowNew {get; set;}
public: __property bool get_AllowNew();
public: __property void set_AllowNew(bool);
public function get AllowNew() : Boolean;
public function set AllowNew(Boolean);

Property Value

true, if new rows can be added; otherwise, false.


[Visual Basic, C#, C++] The following example sets the AllowNew property to true before adding a new row with the AddNew method.

[Visual Basic] 
Private Sub AddNew()
   Dim myTable As DataTable
   myTable = New DataTable
   ' Not shown: code to populate DataTable.
   Dim dv As DataView
   dv = New DataView(myTable)
   dv.AllowNew = True
   Dim drv As DataRowView
   drv = dv.AddNew
   drv("ProductName") = "New Product Name"
End Sub

private void AddNew()
   DataTable myTable = new DataTable();
   // Not shown: code to populate DataTable.
   DataView dv = new DataView(myTable);
   dv.AllowNew = true;
   DataRowView drv = dv.AddNew();
   drv["ProductName"] = "New Product Name";

 void AddNew()
    DataTable* myTable = new DataTable();
    // Not shown: code to populate DataTable.
    DataView* dv = new DataView(myTable);
    dv->AllowNew = true;
    DataRowView* drv = dv->AddNew();
    drv->Item[S"ProductName"] = S"New Product Name";

[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 | AddNew | DataRowView

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft. All rights reserved.