线程间操作无效

          第一种方法:  //线程开始的时候加这么一句(把错误隐藏掉)

            Control.CheckForIllegalCrossThreadCalls = false;

第二种方法:(建议采用)

//建立个委托
        private delegate void ShowDelegate(string strshow);

 

        public void Show(string strshow)

        {

 

            if (this.txtreceive.InvokeRequired)

            {

             //   this.txtreceive.BeginInvoke(new ShowDelegate(Show), strshow);//这个也可以

                this.txtreceive.Invoke(new ShowDelegate(Show), strshow);

            }

            else

            {

                    this.txtreceive.Text += strshow;

            }

        }

原文地址:https://www.cnblogs.com/mingjian/p/3816423.html