Answers for "same click event diffrenet buttonms c#"

C#
0

same click event diffrenet buttonms c#

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
}
Posted by: Guest on June-15-2020
0

same click method lots of buttons c#

button1.Click += myEventHandler;
Posted by: Guest on June-13-2020

C# Answers by Framework

Browse Popular Code Answers by Language