Hi,
I have the following code:
void buttonClick(object sender, EventArgs e)
{
Button bn = sender as Button;
if (bn.Name == “button1”)
{
MessageBox.Show(“Hey its button one”);
}
}
I am interested in the object sender and eventargs e
From what I understand the object is the object that is raising the event, which is a button in this case. I can use the event as an entry point for several objects (again all buttons) and then I can test to see which button was clicked. I have done this in this code.
A couple of questions:
-
Is there anything else I would commonly use the object for?
-
I am unclear on what if anything I can do with the eventargs or ‘e’
Thank you for any help or pointers with this.