积极答复者
如何得到一个非模态对话框的返回值

问题
答案
-
看这个是否满足你的要求
public partial class Form16 : Form { public Form16() { InitializeComponent(); } //将textBox1设为public private void button1_Click(object sender, EventArgs e) { Form17 f17 = new Form17(this); f17.Show(); } private void textBox1_TextChanged(object sender, EventArgs e) { if (textBox1.Text=="ok") { this.Text = "ok"; } if (textBox1.Text=="cancl") { this.Text = "cancl"; } } }
public partial class Form17 : Form { public Form17() { InitializeComponent(); } public Form16 f16; public Form17(Form16 form) { InitializeComponent(); f16 = form; } private void button1_Click(object sender, EventArgs e) { f16.textBox1.Text = "ok"; } private void button2_Click(object sender, EventArgs e) { f16.textBox1.Text = "cancl"; } }
http://blog.csdn.net/zx13525079024- 已标记为答案 scate233 2011年8月4日 1:35
全部回复
-
看这个是否满足你的要求
public partial class Form16 : Form { public Form16() { InitializeComponent(); } //将textBox1设为public private void button1_Click(object sender, EventArgs e) { Form17 f17 = new Form17(this); f17.Show(); } private void textBox1_TextChanged(object sender, EventArgs e) { if (textBox1.Text=="ok") { this.Text = "ok"; } if (textBox1.Text=="cancl") { this.Text = "cancl"; } } }
public partial class Form17 : Form { public Form17() { InitializeComponent(); } public Form16 f16; public Form17(Form16 form) { InitializeComponent(); f16 = form; } private void button1_Click(object sender, EventArgs e) { f16.textBox1.Text = "ok"; } private void button2_Click(object sender, EventArgs e) { f16.textBox1.Text = "cancl"; } }
http://blog.csdn.net/zx13525079024- 已标记为答案 scate233 2011年8月4日 1:35
-
看这个是否满足你的要求
public partial class Form16 : Form { public Form16() { InitializeComponent(); } //将textBox1设为public private void button1_Click(object sender, EventArgs e) { Form17 f17 = new Form17(this); f17.Show(); } private void textBox1_TextChanged(object sender, EventArgs e) { if (textBox1.Text=="ok") { this.Text = "ok"; } if (textBox1.Text=="cancl") { this.Text = "cancl"; } } }
public partial class Form17 : Form { public Form17() { InitializeComponent(); } public Form16 f16; public Form17(Form16 form) { InitializeComponent(); f16 = form; } private void button1_Click(object sender, EventArgs e) { f16.textBox1.Text = "ok"; } private void button2_Click(object sender, EventArgs e) { f16.textBox1.Text = "cancl"; } }
http://blog.csdn.net/zx13525079024
哪个form17的button1事件是它自己的还是form16的? -
在form17类里面的是form17的,在form16里是16的。
Cookie Luo[MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.