BeginEventHandler Delegate
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents the method that handles asynchronous events such as application events. This delegate is called at the start of an asynchronous operation.
public delegate IAsyncResult ^ BeginEventHandler(System::Object ^ sender, EventArgs ^ e, AsyncCallback ^ cb, System::Object ^ extraData);
public delegate IAsyncResult BeginEventHandler(object sender, EventArgs e, AsyncCallback cb, object extraData);
type BeginEventHandler = delegate of obj * EventArgs * AsyncCallback * obj -> IAsyncResult
Public Delegate Function BeginEventHandler(sender As Object, e As EventArgs, cb As AsyncCallback, extraData As Object) As IAsyncResult
Parameters
- sender
- Object
The source of the event.
The delegate to call when the asynchronous method call is complete. If cb is null, the delegate is not called.
- extraData
- Object
Any additional data needed to process the request.
Return Value
The IAsyncResult that represents the result of the BeginEventHandler operation.
Examples
The following code example uses the BeginEventHandler delegate to register a handler an asynchronous page.
Important
This example has a text box that accepts user input, which is a potential security threat. By default, ASP.NET Web pages validate that user input does not include script or HTML elements. For more information, see Script Exploits Overview.
<%@ page language="C#" Async="true"%>
Page.AddOnPreRenderCompleteAsync Example
<%@ page language="VB" Async="true"%>
Page.AddOnPreRenderCompleteAsync Example
Remarks
When you create a BeginEventHandler 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.
Extension Methods
| Name | Description |
|---|---|
| GetMethodInfo(Delegate) |
Gets an object that represents the method represented by the specified delegate. |