public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
if (PropNearest != string.Empty)
{
this.textBox1.Text = PropNearest;
}
}
public string PropNearest
{
get
{
return this.textBox1.Text;
}
set
{
this.textBox1.Text = value;
}
}
private void button1_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2();
f2.Show();
}
}
This is form2 code:
public partial class Form2 : Form
{
Form1 f1 = new Form1();
public Form2()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
f1.PropNearest = textBox1.Text;
f1.Refresh();
}
}