I have a button that calls the btn_Salvar click event in my form.
How do I make this event click call different methods according to who created the form the button is contained in?
EDIT:
Explaining better: I have the Form "frmPrincipal", this "frmPrincipal" contains two menus, "producerRuralToolStripMenuItem" and "PersonFolicaToolStripMenuItem". Both call the same Form, but with some controls disabled. This btn_Save has to execute a method depending on the Menu item that called it.
I believe that with IF ELSE I would solve the problem, but I want to avoid the use of IF ELSE as much as possible.
I'm developing this layered application: AccessDatas, GUI, Business, ObjectTransfer. Would it be correct for me to create a class inside the GUI layer to solve this problem?
Follow the code below:
private void pessoaFisicaToolStripMenuItem_Click(object sender, EventArgs e)
{
Form frmCadPessoaFisica = new frmCadastroPessoas(new tipoFormPessoaFisica());
frmCadPessoaFisica.MdiParent = this;
frmCadPessoaFisica.Show();
}
private void produtorRuralToolStripMenuItem_Click(object sender, EventArgs e)
{
Form frmCadPessoaProd = new frmCadastroPessoas(new tipoPessoaFormProdutor());
frmCadPessoaProd.MdiParent = this;
frmCadPessoaProd.Show();
}