I want to fill a combobox on Form1 , when the OK button on Form2 is clicked.
First, the Load Form2 button on Form1 is clicked to display Form2. Then, Form2 appears, and
Updated
You can try passing Form1 instance in the constructor of Form2
Example:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Form2 form2 = new Form2(this);
form2.Show();
}
internal void TestMethod()
{
throw new NotImplementedException();
}
}
public partial class Form2 : Form
{
private Form1 form1;
public Form2()
{
InitializeComponent();
}
public Form2(Form1 form1)
: this()
{
// TODO: Complete member initialization
this.form1 = form1;
}
private void button1_Click(object sender, EventArgs e)
{
form1.TestMethod();
}
}
Updated
try this:
public FORM2(SqlConnection connfromFORM3, FORM1 form1)
{
this.form1 = form1;
Form2Conn = connfromFORM3;
InitializeComponent();
}