veayou
asked on
Can any experts explain me (How it work) about the 2 arguments of event procedure in VB.NET?
I am new to vb.net. I know only when I double a button on a form I will write code for its click event. But now I would like to understand about its 2 arguments: sender and e.
sub button1_click(sender as object, e as eventargs) handles button1.click
How they work? and can they be used in anyway?
Thank you.
sub button1_click(sender as object, e as eventargs) handles button1.click
How they work? and can they be used in anyway?
Thank you.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you. Idle_Mind.
BM.
Thank you very much. This answer make me understand clearer. But I think I have read a book and have met this example before. However, do you have any idea about them like:
-why they are created?
-I heard my teacher say "the old version, some events use different arguments but in vb.net all event have only this 2 argument.
The reason they have these two arguments is because the entire .Net framework is object oriented and all events for all controls and objects derive from a common class. So if an event doesn't actually have any information to convey except that the event itself occurred, then it still must have these two arguments (because they were inherited) but those arguments are simply empty.
So the answer to your question of "why they are created?" is simply, "because of Inheritance"
~IM