S
saulij
I have an array of buttons. There is a common Click-method for these
buttons.
How can I find what button is clicked?
Sauli
buttons.
How can I find what button is clicked?
Sauli
I have an array of buttons. There is a common Click-method for these
buttons.
How can I find what button is clicked?
Sauli
In the event handler, first arg would be "object sender". you can
identify the sender through this argument. (I believe so)
I haven't tried this but it should work.
Private void Common_Click(Object sender, EventArgs e)
{
Button btn = (Button)sender;
switch (btn.Name)
{
case "btnButton1":
Do something for button1;
break;
case "btnButton2":
Do something for button2;
break;
etc ...
}
}- Hide quoted text -
- Show quoted text -
This works fine, Thanks a lotnice to see some code here. The same approach I was suggesting.
Saulij, Please let us know if it solves your issue.
-Cnu