两个窗体之间传值

类别:.NET开发 点击:0 评论:0 推荐:

Form1中放一个Label1,一个Button1,Form1为主窗口,当点击Button1时,执行:
Form2 f2 = new Form2();
f2.ShowDialog(this);

Form2中放一个TextBox1,一个Button1,当点击Button1时执行:

Form1 f1 = (Form1)this.Owner;
f1.Label1.Text = this.TextBox1.Text;

注意:Form1中的label1要设为public

 

 

本文地址:http://com.8s8s.com/it/it44357.htm