Why not us an enum? e.g.
public enum ActionType { button1, button2 };
public delegate void Confirmation(bool answer, ActionType actionType);
public event Confirmation sendConfirmation;
private void button1_Click(object sender, EventArgs e)
{
this.sendConfirmation(true, ActionType.button1);
this.Dispose();
}
private void button2_Click(object sender, EventArgs e)
{
this.sendConfirmation(false, ActionType.button2);
this.Dispose();
}
in main form
public void performAction(NextForm.ActionType actionType)
{
switch(actionType) {
case NextForm.ActionType.<pre>
Button1;
break;
case NextForm.ActionType.Button2;
break;
}
}
Also in NextForm you could set the tag on each button to the enum e.g.
button1.Tag = ActionType.button1;
button2.Tag = ActionType.button2;
then have one handler
private void any_button_Click(object sender, EventArgs e)
{
this.sendConfirmation(true, (ActionType)(sender as Button).Tag);
}