父窗体Form1,子窗体Form2。
---父窗体中弹出子窗体按钮事件代码:
Form2 f2=new Form2();
f2.Owner=this;//令Form2的父窗体为Form1
f2.ShowDialog();//ShowDialog打开模式窗体。即操作这个窗体时,其他窗体不可以操作。
---子窗体中更改父窗体控件代码,控件Label的Name为lblPowOffTime。
this.Owner.Controls["lblPowOffTime"].Text = "test";
联系客服