I've been having a hard time transferring my variable values from my form 1 to my form2. The thing is I want to show the results I initialized in my Form1, in Form2 textBoxes as soon as the Form 2 loads (Which appears with a a ShowDialog() when I click the appropriate button).
My problem is the results don't transfer in my Form2, giving all my variables a 0 value.
Here's what I put in my Forms:
//Variables in my Form 1
public partial class Form1 : Form
{
public static double VAR_1 = 1;
public static double VAR_2 = 2;
public static double VAR_3 = 3;
//Here I put all my textBoxes and other methods of the class
}
//Variables in my Form 2
public partial class Form2 : Form
{
private void Form2_Load(object sender, EventArgs e)
{
this.textBox1.Text = Form1.VAR_1.ToString();
this.textBox2.Text = Form1.VAR_2.ToString();
this.textBox3.Text = Form1.VAR_3.ToString();
}
}