C# Programming
09-08-2009, 08:54 AM
Hi All,
If I have a form with several buttons and the click event handler for all the buttons points to the same handler, how can I determine in handler which button was clicked?
this.button1.Click += new System.EventHandler(this.button_ClickHandler);
this.button2.Click += new System.EventHandler(this.button_ClickHandler);
this.button3.Click += new System.EventHandler(this.button_ClickHandler);
private void button_ClickHandler(object sender, EventArgs e)
{
MessageBox.Show("Who raised this event?");
}
If I have a form with several buttons and the click event handler for all the buttons points to the same handler, how can I determine in handler which button was clicked?
this.button1.Click += new System.EventHandler(this.button_ClickHandler);
this.button2.Click += new System.EventHandler(this.button_ClickHandler);
this.button3.Click += new System.EventHandler(this.button_ClickHandler);
private void button_ClickHandler(object sender, EventArgs e)
{
MessageBox.Show("Who raised this event?");
}