Assembly: System (in system.dll)
The AddingNewEventArgs class provides data for the BindingSource.AddingNew event, which signals that an item is about to be added to a collection. The event gives the programmer, within the event handler AddingNewEventHandler, the option of supplying the new object by setting the NewObject property to this new item. If this property is not set, the collection will typically use the default constructor of the appropriate type to construct a new item. In either case, the new item will be added to the collection.
If the collection also implements the ICancelAddNew interface, the item will be provisionally added, waiting a subsequent commit or rollback.
For more information about handling events, see Consuming Events.
The HostProtectionAttribute attribute applied to this class has the following Resources property value: SharedState. The HostProtectionAttribute does not affect desktop applications (which are typically started by double-clicking an icon, typing a command, or entering a URL in a browser). For more information, see the HostProtectionAttribute class or SQL Server Programming and Host Protection Attributes.
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.
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter EditionThe Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.