//主线程 public delegate void UpdateMessage(string mes); public void UpdatePortMessage(string mes) { this.txtMessage.AppendText(string.Format("Connected {0}. succeed", mes) + " "); this.txtClientIP.Text = mes; } // 线程1 UpdateMessage upPort = new UpdateMessage(UpdatePortMessage); this.BeginInvoke(upPort, point);
https://msdn.microsoft.com/zh-cn/library/ms171728(v=VS.80).aspx