/
AddingNewEventHandler.xml
84 lines (76 loc) · 6.49 KB
/
AddingNewEventHandler.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<Type Name="AddingNewEventHandler" FullName="System.ComponentModel.AddingNewEventHandler">
<TypeSignature Language="C#" Value="public delegate void AddingNewEventHandler(object sender, AddingNewEventArgs e);" FrameworkAlternate="net-5.0;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netcore-3.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1;netstandard-2.0;netstandard-2.1" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi sealed AddingNewEventHandler extends System.MulticastDelegate" />
<TypeSignature Language="DocId" Value="T:System.ComponentModel.AddingNewEventHandler" />
<TypeSignature Language="VB.NET" Value="Public Delegate Sub AddingNewEventHandler(sender As Object, e As AddingNewEventArgs)" />
<TypeSignature Language="F#" Value="type AddingNewEventHandler = delegate of obj * AddingNewEventArgs -> unit" />
<TypeSignature Language="C++ CLI" Value="public delegate void AddingNewEventHandler(System::Object ^ sender, AddingNewEventArgs ^ e);" />
<TypeSignature Language="C#" Value="public delegate void AddingNewEventHandler(object? sender, AddingNewEventArgs e);" FrameworkAlternate="net-6.0;net-7.0;net-8.0;net-9.0" />
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.ComponentModel.TypeConverter</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.2.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<TypeForwardingChain>
<TypeForwarding From="netstandard" FromVersion="2.1.0.0" To="System.ComponentModel.TypeConverter" ToVersion="5.0.0.0" FrameworkAlternate="net-5.0" />
<TypeForwarding From="netstandard" FromVersion="2.1.0.0" To="System.ComponentModel.TypeConverter" ToVersion="6.0.0.0" FrameworkAlternate="net-6.0" />
<TypeForwarding From="netstandard" FromVersion="2.1.0.0" To="System.ComponentModel.TypeConverter" ToVersion="7.0.0.0" FrameworkAlternate="net-7.0" />
<TypeForwarding From="netstandard" FromVersion="2.1.0.0" To="System.ComponentModel.TypeConverter" ToVersion="8.0.0.0" FrameworkAlternate="net-8.0" />
<TypeForwarding From="netstandard" FromVersion="2.1.0.0" To="System.ComponentModel.TypeConverter" ToVersion="9.0.0.0" FrameworkAlternate="net-9.0" />
</TypeForwardingChain>
<Base>
<BaseTypeName>System.Delegate</BaseTypeName>
</Base>
<Parameters>
<Parameter Name="sender" Type="System.Object">
<Attributes>
<Attribute FrameworkAlternate="net-8.0;net-9.0">
<AttributeName Language="C#">[System.Runtime.CompilerServices.Nullable(2)]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.CompilerServices.Nullable(2)>]</AttributeName>
</Attribute>
</Attributes>
</Parameter>
<Parameter Name="e" Type="System.ComponentModel.AddingNewEventArgs" />
</Parameters>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Docs>
<param name="sender">The source of the event, typically a data container or data-bound collection.</param>
<param name="e">A <see cref="T:System.ComponentModel.AddingNewEventArgs" /> that contains the event data.</param>
<summary>Represents the method that will handle the <see cref="E:System.Windows.Forms.BindingSource.AddingNew" /> event.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Windows.Forms.BindingSource.AddingNew?displayProperty=nameWithType> event occurs prior to adding a new item to a collection, typically in data-binding scenarios. The handler of this event can supply the new item to be added, overriding the standard action of the collection class. This is accomplished by setting the <xref:System.ComponentModel.AddingNewEventArgs.NewObject%2A> property of the <xref:System.ComponentModel.AddingNewEventArgs> parameter `e` to this new item. Typically this item must be of a type expected by the recipient collection, or the collection will throw an exception of type <xref:System.InvalidCastException>.
This event is commonly used in data-binding scenarios, within classes such as <xref:System.Windows.Forms.BindingSource?displayProperty=nameWithType> and <xref:System.ComponentModel.BindingList%601?displayProperty=nameWithType>.
When you create an <xref:System.ComponentModel.AddingNewEventHandler> delegate, you identify the method that will handle the event. To associate the event with your event handler, add an instance of the delegate to the event. The event handler is called whenever the event occurs, unless you remove the delegate. For more information about event-handler delegates, see [Handling and Raising Events](/dotnet/standard/events/).
## Examples
The following code example demonstrates how to use the <xref:System.ComponentModel.AddingNewEventHandler> delegate to handle the <xref:System.Windows.Forms.BindingSource.AddingNew?displayProperty=nameWithType> event. This code example is part of a larger example provided in [How to: Customize Item Addition with the Windows Forms BindingSource](/dotnet/framework/winforms/controls/how-to-customize-item-addition-with-the-windows-forms-bindingsource).
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnector.AddingNew/CPP/form1.cpp" id="Snippet8":::
:::code language="csharp" source="~/snippets/csharp/System.ComponentModel/AddingNewEventArgs/Overview/form1.cs" id="Snippet8":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataConnector.AddingNew/VB/form1.vb" id="Snippet8":::
]]></format>
</remarks>
<altmember cref="T:System.ComponentModel.AddingNewEventArgs" />
<altmember cref="T:System.Windows.Forms.BindingSource" />
<altmember cref="T:System.ComponentModel.BindingList`1" />
</Docs>
</Type>