Hi,
This is one way of doing it.
Attach one variables each to your individual forms.
(ClassView -> Right click form name -> Add -> Add Field)
public static string strFormOne;
public static string strFormTwo;
Then create a click event in the first form(This where you enter your data).
private void button1_Click(object sender, System.EventArgs e)
{
Form1.strFormOne = textBox1.Text;
Form2.strFormTwo = Form1.strFormOne;
MessageBox.Show("Form One " + Form1.strFormOne);
MessageBox.Show("Form Twee " + Form2.strFormTwo);
Form2 frm = new Form2();
frm.Show();
}
This part you can put in an load statement or in a click event.
private void button1_Click(object sender, System.EventArgs e)
{
label1.Text = Form2.strFormTwo;
MessageBox.Show("Inside Form Twee " + Form2.strFormTwo);
}
I did test the code(built this one quickly) so it should work.
As I said this is one way of doing it, if you find a better way, let me know.
Good luck
Jan
dude_in_africa
|