ASP. NET learning notes (6) Events

Source: Internet
Author: User

I. How events run
The event receiver has a method to execute the event processing program when a registered event occurs and use the delegate as the intermediary between the sender and receiver. The sender defines the delegate to be used by the receiver, the receiver registers the event handler to the event.

Form constructor:

EventHandler is the delegate that an event is used to assign a handler (Button_Click) to an event (Click ).

The EventHandler delegate has been defined by. NET Framework, so you must use it for all defined events. The same signature must be used:

1. It must be void and the event handler cannot return values.
2. The object parameter is the object that triggers the event. Therefore, you can assign an event to multiple objects. For example, you can determine which button is based on the sender;
3. EventArgs is an object that contains events and other information. It can be of any type, as long as it is derived from EventArgs.

Ii. Create an event

By: dxh_0829
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.