Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

BindingList.AddingNew Event

Occurs before an item is added to the list.

Namespace: System.ComponentModel
Assembly: System (in system.dll)

public event AddingNewEventHandler AddingNew
/** @event */
public void add_AddingNew (AddingNewEventHandler value)

/** @event */
public void remove_AddingNew (AddingNewEventHandler value)

In JScript, you can handle the events defined by a class, but you cannot define your own.
Not applicable.

The AddingNew event occurs before a new object is added to the collection represented by the Items property. This event is raised after the AddNew method is called, but before the new item is created and added to the internal list. By handling this event, the programmer can provide custom item creation and insertion behavior without being forced to derive from the BindingList class.

For more information about supplying custom new item functionality, see the AddNew method. For more information about handling events, see Consuming Events.

The following code example demonstrates how to handle the AddingNew event. For the complete example, see the BindingList class overview topic.

// Create a new part from the text in the two text boxes.
void listOfParts_AddingNew(object sender, AddingNewEventArgs e)
{
    e.NewObject = new Part(textBox1.Text, int.Parse(textBox2.Text));
    
}

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 Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

.NET Compact Framework

Supported in: 2.0

XNA Framework

Supported in: 1.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.