VB.net eventargs sender and E

Source: Internet
Author: User

Eventargs is the base class of the class containing event data, used to pass event details.

Usually in the source code, this is the case: protected void eventhandler (Object sender, eventargs E)

Eventargs is a delegate declaration. The parameter here. The former is an object (in fact, the object is referenced here. If it is a click event of button1, sender is button1 ), the following is the base class of the class that contains event data.

In fact, simply put, the object sender causes an event. The content of the event is (e)

InProgramThe event processing function in is implemented based on eventhandler:

For example, if you click a button, how does the program know which function should be used to handle this action? Then eventhandler will tell the program: "button1 (sender) is clicked (e), please call the corresponding processing function ". Of course, who this function is and what it is to do is written by yourself.

Further, this process is actually: Your action is captured by windows, and Windows sends this action to the program as a system message (you can view the message structure ), the program continuously extracts messages from its own message queue and finds corresponding processing methods in the message loop, in this case, similar to sender and E in the message structure play the role of the Bootstrap program to use the correct processing function.

Finally, this sender and E and their entire processing method are just another manifestation of the Windows message mechanism.

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.