I have come across this code but not getting it.
it will help to learn new thing if someone explains this code and its use.
Thanx in advance.
I have come across this code but not getting it.
it will help to learn new thing if someone explains this code and its use.
Thanx in advance.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Ashish ShuklaRank #458 · 5.5K reputationPosted May 8, 2013, 12:13 AM EDT
EventArgs contains additonal event information.
Since the sender is of type object if we want to retreive information from it we need
to typecast it.
Following represnets a typical click event handler method signature
private void ButtonClick(object sender, EventArgs e)
Since in the above scenario it is of type button hence it is cast to Button using (Button)Sender
Please let me know if this answers your question.
Trupti Rane10 reputationPosted May 9, 2013, 4:25 AM EDT
VulpesRank #55 · 29.2K reputationPosted May 9, 2013, 5:39 AM EDT
Once you've added an eventhandler for one button, you'll find that in the Properties Box for other buttons the existing handler can be selected from a drop-down list.
In these cases the 'sender' argument contains a reference to which button was actually clicked.
Exactly the same principle applies to other controls and events.