Reputation: 13
I have code in jQuery:
// Group of buttons
$(".buttons").click(function() {
// Do something with one button
$(this). ...
});
I have an another program in C# Window Forms:
private void someButtons_Click(object sender, EventArgs e) {
// How to know which button was clicked?
// How to get an instance of that button?
}
Many thanks!
Upvotes: 0
Views: 77
Reputation: 6389
private void someButtons_Click(object sender, EventArgs e)
{
// How to get an instance of that button?
Button myButton = ((Button)sender);
// How to know which button was clicked?
string buttonId = myButton.ID;
}
Upvotes: 1
Reputation: 22054
You mean something like
private void someButtons_Click(object sender, EventArgs e) {
var button = (Button)sender;
}
Upvotes: 2