I have three WinForms .. Form1 Form2 and Form3
// Form1 Button
private void btF1_Click(object sender, EventArgs e)
{
new Form3(this).ShowDialog();
}
// Form2 Button
private void btF21_Click(object sender, EventArgs e)
{
new Form3(this).ShowDialog();
}
// Form3
public partial class AjoutDemandeur : Form
{
Form1 _owner;
Form2 _owner2;
public Form3(Form1 owner, Form2 owner2)
{
InitializeComponent();
_owner = owner;
_owner2 = owner2;
}
private void button1_Click(object sender, EventArgs e)
{
_owner.methodForm1(); //call a method from Form1
}
private void button2_Click(object sender, EventArgs e)
{
_owner2.methodForm2(); // call a method from Form2
}
I want to call a method from Form1 and Form2 into the Form3 But the problem is in the two buttons btF1 and btF2 => there is no argument given that corresponds to the required formal parameter 'owner2' of 'Form3.Form3(Form1, Form2)' So any solutions !