当你的才华不能撑起你的野心时,就是你该选择学习的时候了!

Cross-thread operation not valid: Control 'txtMessage' accessed from a thread other than the thread it was created on.

Winform TextBox

 

Cross-thread operation not valid: Control 'txtMessage' accessed from a thread other than the thread it was created on.

 

(330条消息) 解决Cross-thread operation not valid的问题_GuanXX的博客-CSDN博客

 

 

 private void safeSetText(string text) {
            if (this.InvokeRequired) {
                _SafeSetTextCall call = delegate(string s) {
                    this.textBox1.Text = s;
                };
 
                this.Invoke(call, text);
            }
            else
                this.textBox1.Text = text;
        }
 
        private delegate void _SafeSetTextCall(string text);

 

posted @ 2023-06-30 09:58  hofmann  阅读(31)  评论(0)    收藏  举报