// Form1
// I have a text box and I want the value to pass onto a text box on form 2
private void button1_Click(object sender, EventArgs e)
{
Form2 form2 = new Form2();
form2.Show();
}
// Form2
private Form1 otherForm;
private void Form2_Load(object sender, EventArgs e)
{
string test = textBox1.Text;
otherForm.textBox1.Text = test;
}
When I try to pass the value onto the textBox on form two it says "Exception has been thrown by the target of an invocation."
I've changed the protection to public also but I'm having no success with passing the string along.