zoukankan      html  css  js  c++  java
  • 线程间操作无效

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

                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;

                }

            }

  • 相关阅读:
    Extjs常用的控件
    JasperReport导出
    spring配置连接池
    extjs中xtype类型

    凭什么!
    用心去做,多动脑思考
    闲着无事弄一下荒废已久的博客。。。

    视频下载工具 3.0
  • 原文地址:https://www.cnblogs.com/mingjian/p/3816423.html
Copyright © 2011-2022 走看看