发个C# 窗口互相传值的实例代码

  这个实例很简单,一看就懂。用VS2008编写!      实例是2个窗口动态传值。已经打包上传了,在文章最下方点击下载!

//namespace 窗口传值
public partial class Form2 : Form
public string returnValue;//给方框一内容赋值
public string returnValuea;//给方框二内容赋值
InitializeComponent();
this.textBox1.Text = txtValue;//写入值
this.textBox2.Text = txtValuea;//写入值
private void Form2_Load(object sender, EventArgs e)
private void button1_Click(object sender, EventArgs e)
this.textBox1.Text;//给方框一重新赋值
this.textBox2.Text;//给方框二重新赋值
this.Close();
private void button2_Click(object sender, EventArgs e)


namespace 窗口传值{    public partial class Form2 : Form    {        public string returnValue;//给方框一内容赋值        public string returnValuea;//给方框二内容赋值        public Form2(string txtValue,string txtValuea)//接收FORM1传过来的值        {            InitializeComponent();            this.textBox1.Text = txtValue;//写入值            this.textBox2.Text = txtValuea;//写入值
 }
 private void Form2_Load(object sender, EventArgs e)        {
 }
 private void button1_Click(object sender, EventArgs e)        {            returnValue = this.textBox1.Text;//给方框一重新赋值            returnValuea = this.textBox2.Text;//给方框二重新赋值            this.Close();        }
 private void button2_Click(object sender, EventArgs e)        {
 }    }}

C#FORM-POST