I\'m developing a program that has many buttons that should do a similar action when clicked, but with a small difference based on which button was clicked. The problem is t
Is there a way to program simply one block that would get the click on any button and which button was clicked?
I would just use the same click event and conditionally check the sender for which button was clicked
private void button1_Click(object sender, System.EventArgs e)
{
if(sender == button1)
{
//do something different for button1
}
else if(sender == button2)
{
....
}
}
Or a switch statement..