You can attach the same event to multiple buttons by binding the same method to each buttons click event
myButton1.Click += new MyButtonClick;
myButton2.Click += new MyButtonClick;
myButton3.Click += new MyButtonClick;
myButton4.Click += new MyButtonClick;
myButton5.Click += new MyButtonClick;
myButton6.Click += new MyButtonClick;
void MyButtonClick(object sender, EventArgs e)
{
Button button = sender as Button;
//here you can check which button was clicked by the sender
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…