c# 线程间操作无效: 从不是创建控件“textBox1”的线程访问它。解决方法

方法一:
        private delegate void daili();
        String showtext = "";
        private void show(String text)
        {
            showtext = text;
            daili dl = new daili(showd);
            this.BeginInvoke(dl);
        }
        private void showd()
        {
            this.textBox1.AppendText(showtext + "\n");
        }

方法二:

System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = false;

你可能感兴趣的:(C#)