Jus*_*ner 15
如果您尝试使用WinForms,则可以在"子"表单中实现自定义事件.单击"子"表单中的按钮时,可能会触发该事件.
然后,您的"父"表单将侦听事件并处理它自己的TextBox更新.
public class ChildForm : Form
{
public delegate SomeEventHandler(object sender, EventArgs e);
public event SomeEventHandler SomeEvent;
// Your code here
}
public class ParentForm : Form
{
ChildForm child = new ChildForm();
child.SomeEvent += new EventHandler(this.HandleSomeEvent);
public void HandleSomeEvent(object sender, EventArgs e)
{
this.someTextBox.Text = "Whatever Text You Want...";
}
}
Run Code Online (Sandbox Code Playgroud)