Event Handling
-
Hi, Am just learning ASP.NET can u tell me wats the difference if the first parameter in a event handler is source or sender? Tht is, if it is EventHandler1(object source, EventArgs e) or EventHandler2(object sender, EventArgs e). What does that actually signify?:confused: Regards, Sriraj.
-
Hi, Am just learning ASP.NET can u tell me wats the difference if the first parameter in a event handler is source or sender? Tht is, if it is EventHandler1(object source, EventArgs e) or EventHandler2(object sender, EventArgs e). What does that actually signify?:confused: Regards, Sriraj.
-
Sender signifies the object raising the event. If you click on a button then sender will be button object.
Regards, Prakash Kalakoti
-
Thanks Prakash. but one more small clarification I need then sometimes I have seen that, this is replaced with Source. Tht is (Object Source, ...) Wat does tht mean? source is being used in which context? :)
Regards, Sriraj.
See look only over upon the type of argument that supplied to function. Source is the only variable that is of type object so it doesnt matter whether it is sender or source, the logic is same
Hello Forum Always be in touch to help about the topic ASP.NET
-
Hi, Am just learning ASP.NET can u tell me wats the difference if the first parameter in a event handler is source or sender? Tht is, if it is EventHandler1(object source, EventArgs e) or EventHandler2(object sender, EventArgs e). What does that actually signify?:confused: Regards, Sriraj.
As far as I'm aware they're the same thing, just two different conventions for naming the variable....typical of MS to not stick to their own naming conventions :wtf:. Remember, the name of the variable doesn't matter, basically it will always reference the control that fired the event (sometimes it might be null but not sure why)
-
See look only over upon the type of argument that supplied to function. Source is the only variable that is of type object so it doesnt matter whether it is sender or source, the logic is same
Hello Forum Always be in touch to help about the topic ASP.NET
-
As far as I'm aware they're the same thing, just two different conventions for naming the variable....typical of MS to not stick to their own naming conventions :wtf:. Remember, the name of the variable doesn't matter, basically it will always reference the control that fired the event (sometimes it might be null but not sure why)