Windows窗体间的数据交互
http://blog.csdn.net/zhzuo/archive/2004/04/05/22027.aspx
窗体的参数传递
http://blog.csdn.net/zhzuo/archive/2006/05/05/708941.aspx#sec5
http://blog.csdn.net/zhzuo/archive/2004/04/05/22027.aspx
窗体的参数传递
http://blog.csdn.net/zhzuo/archive/2006/05/05/708941.aspx#sec5
窗体互相引用增加了 耦合 度. 建议楼主用 Delegate+Event, 如下是实例:
1 定义一个公用的委托
public delegate void SetTextBoxValueDelegate(string strValue);2 主窗体 Form1:
public Form1()
{
InitializeComponent();
}private void SetTextBoxValue(string strValue)
{
this.textBox.Text=strValue;
}private void button1_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2();
f2.SetTextBoxValueEvent=new SetTextBoxValueDelegate(SetTextBoxValue);
f2.ShowDialog();
}3 Form2public event SetTextBoxValueDelegate SetTextBoxValueEvent;
private void button1_Click(object sender, EventArgs e)
{
SetTextBoxValueEvent(this.textBox1.Text);
}
}