zoukankan      html  css  js  c++  java
  • WebBrowser 错误处理

    一般来说,将WebBrowser控件ScriptErrorsSuppressed 设置为True,可禁止弹出脚本错误对话框,ScriptErrorsSuppressed属性是对其基础COM控件的Silent属性的封装,因此设置ScriptErrorsSuppressed属性和设置其基础COM控件的Slient属性是效果一样的,这一点通过反编译System.Windows.Forms程序集可以证实。

    不过要注意的是:
    ScriptErrorsSuppressed 设置为True会禁用所有的对话框,比如提示Activex下载、执行以及安全登录等对话框。

    如果不想禁止除脚本错误之外的对话框,请使用MSDN上的代码示例:

    View Code
    private void browser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)  
    {  
        ((WebBrowser)sender).Document.Window.Error 
    += new HtmlElementErrorEventHandler(Window_Error);  
    }  
      
    private void Window_Error(object sender, HtmlElementErrorEventArgs e)  
    {  
        
    // Ignore the error and suppress the error dialog box.   
        e.Handled = true;  
  • 相关阅读:
    Thread类常用方法
    sql 语句NVL()用法
    SQL极限函数limit()详解<分页必备>
    查询用户上次登录时间问题
    ROWNUM-Oracle中的分页代码
    分组统计查询
    Oracle中的多表查询
    Oracle中的单行函数
    JDBC中的事务-Transaction
    MySql中增加一列
  • 原文地址:https://www.cnblogs.com/1971ruru/p/2142896.html
Copyright © 2011-2022 走看看