DataView.AllowNew Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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

Namespace:   System.Data
Assembly:  System.Data (in System.Data.dll)

Public Property AllowNew As Boolean

Property Value

Type: System.Boolean

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

The following example sets the AllowNew property to true before adding a new row with the AddNew method.

Private Sub AddNew()
    Dim table As DataTable = New DataTable

    ' Not shown: code to populate DataTable.

    Dim view As DataView = New DataView(table)
    view.AllowNew = True
    Dim rowView As DataRowView
    rowView = view.AddNew
    rowView("ProductName") = "New Product Name"
End Sub

.NET Framework
Available since 1.1
Return to top
Show: