日期:2014-05-18 浏览次数:20989 次
namespace other
{
class function1
{
private void UpdateLab (string str)
{
//这里想更改 namepace 用户系统 form1 里一个 Label1.text
用户系统.Form1 frm1 = new 用户系统.Form1();
frm1.Label1.Text = str;
}
}
}
------解决方案--------------------
(1)将Form1中的Label1定义成public类型的
(2) public function1(Form1 f) { _f = f; }
private Form1 _f;
private void UpdateLab(string str)
{
_f.Label1.text = "xxx";
}
(3)窗体调用:
function1 f1 = new function1(this);
...