Winform 文本框多线程赋值

 delegate void SetTextCallback(string text);
 private void showClientMsg(string text)
        {
            // InvokeRequired required compares the thread ID of the
            // calling thread to the thread ID of the creating thread.
            // If these threads are different, it returns true.
            if (this.rtbShowinfo.InvokeRequired)
            {
                SetTextCallback d = new SetTextCallback(showClientMsg);
                this.Invoke(d, new object[] { text });
            }
            else
            {
                this.rtbShowinfo.AppendText(text + "\r\n");
            }
        }

 

你可能感兴趣的:(Winform 文本框多线程赋值)