Gets or sets the object to be added to the binding list.
Assembly: System (in System.dll)
Public Property NewObject As Object Get Set
public Object NewObject { get; set; }
public: property Object^ NewObject { Object^ get (); void set (Object^ value); }
member NewObject : Object with get, set
If the NewObject property is set to null, it indicates that the collection is to take the standard action, which typically entails creating an object of the appropriate type using its default constructor, and then adding it to the collection.
The following code example demonstrates how to use the AddingNewEventArgs class to handle the BindingSource.AddingNew event. This code example is part of a larger example provided in How to: Customize Item Addition with the Windows Forms BindingSource.
' This event handler provides custom item-creation behavior. Private Sub customersBindingSource_AddingNew( _ ByVal sender As Object, _ ByVal e As AddingNewEventArgs) _ Handles customersBindingSource.AddingNew e.NewObject = DemoCustomer.CreateNewCustomer() End Sub
// This event handler provides custom item-creation behavior. void customersBindingSource_AddingNew( object sender, AddingNewEventArgs e) { e.NewObject = DemoCustomer.CreateNewCustomer(); }
// This event handler provides custom item-creation behavior. void OnCustomersBindingSourceAddingNew(Object^ sender, AddingNewEventArgs^ e) { e->NewObject = DemoCustomer::CreateNewCustomer(); }
.NET Framework
Supported in: 4, 3.5, 3.0, 2.0.NET Framework Client Profile
Supported in: 4, 3.5 SP1Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.