This is my code:
namespace Class_Properties {
public partial class Form1 : Form {
private string firstHeight1 = "";
public int firstHeight {
get {
return Convert.ToInt32( firstHeight1 );
}
}
public Form1() {
InitializeComponent();
}
private void button1_Click( object sender, EventArgs e ) {
firstHeight1 = textBox2.Text;
Form2 secondForm = new Form2();
secondForm.Show();
}
}
}
and then the other class:
namespace Class_Properties {
public partial class Form2 : Form {
public Form2() {
InitializeComponent();
Form1 mainWindow = new Form1();
this.Height = mainWindow.firstHeight;
}
}
}
When I run, I type 200 as value for textbox2 and click button1, then Visual Studio says the following exception:

What could I do to solve this error?