2
I have a button that calls the click event btn_Salvar in my form.
How do I call this event different methods according to who created the form in which the button is contained?
EDIT:
Explaining better: I have the form "frmPrincipal", this "frmPrincipal" contains two menus, "productorRuralToolStripMenuItem" and "personFisicaToolStripMenuItem". The two call the same Form, but with some disabled controls. This btn_Salvar has to perform a method depending on the itemMenu that called it.
I believe that with IF ELSE I would solve the problem, however I want to avoid the use of IF ELSE as much as possible.
I am developing this application in layers: Accessodados, GUI, Negocios, Objetotransferencia. It would be correct for me to create a class within the GUI layer to solve this problem?
Follows code:
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();
    } 
						
Could explain better what you try to do with code examples?
– Marconi
according to who created the form - would not be you who created the form? You can give more details about your situation?
– brazilianldsjaguar
I made an Edit explaining better, thank you.
– Robss70