zoukankan      html  css  js  c++  java
  • 多线程委托函数中访问webbrowser 等UI窗体控件,报错“由于以前的函数求值超时,函数求值被禁用+用户已关闭隐式函数计算。”

     
            public delegate String GetKuaidiInfoDelegate();
            public String GetKuaidiInfo()
            {
                if (webBrowser1.InvokeRequired)
                {
                    GetKuaidiInfoDelegate cb = new GetKuaidiInfoDelegate(GetKuaidiInfo);
                    String strContext = this.Invoke(cb).ToString(); ;
                    return strContext;
                }
                else
                {
                    String strContext = webBrowser1.Document.Body.InnerHtml;
                    return strContext;
                }
            }

    其中改为

    public String GetKuaidiInfo()
    {
        if (webBrowser1.InvokeRequired)!!关键
        {
            GetKuaidiInfoDelegate cb = new GetKuaidiInfoDelegate(GetKuaidiInfo);
            String strContext = this.Invoke(cb).ToString(); ;
            return strContext;
        }
        else
        {
            String strContext = webBrowser1.Document.Body.InnerHtml;
            return strContext;
        }
    }
  • 相关阅读:
    odoo邮箱系统
    运行odoo13,走的odoo12的数据库
    字段`in_group_69`不存在
    odoo库存
    Codeforces 1430E
    AtCoder "Regular Contest 102" D
    AtCoder "Grand Contest 041" E
    ZJNU 2471
    ZJNU 2455
    Codeforces 1426F
  • 原文地址:https://www.cnblogs.com/carl2380/p/2671838.html
Copyright © 2011-2022 走看看