一个winform程序 ,里面有个webBrowser , webBrowser读取的是一个HTML文件,我想要把webBrowser里面自己想要的东西解析出来,用了mshtml  
  下面是错误的地方:
 mshtml.IHTMLDocument2 doc = (mshtml.IHTMLDocument2)webBrowser1.Document;
                        //取得网页中包含的所有文本内容doc.body.innerText              mshtml.IHTMLElementCollection collection = doc.all;下面是报的错:
错误 129 无法将类型“System.Windows.Forms.HtmlDocument”转换为“mshtml.IHTMLDocument2” 我一前在03用可以,现在在05里不成了,不知道是什么原因
请各位高手解答,~~分不够再加~~
谢谢

解决方案 »

  1.   

    (mshtml.IHTMLDocument2)webBrowser1.Document是这句转换出错了,不能强制转换。可能是05的转换方法不同吧~我也没接触过。
      

  2.   

    刚查了一下资料。lz试试这个
    mshtml.IHTMLDocument2 doc = WebBrowser1.Document.DomDocument
    应该能用在05里面
      

  3.   

    mshtml.IHTMLElementCollection collection = doc.all as IHTMLDocument2;
    要转换
      

  4.   

    Gummy() 
    刚查了一下资料。lz试试这个
    mshtml.IHTMLDocument2 doc = WebBrowser1.Document.DomDocument
    应该能用在05里面
    =========================================
    呵呵  我比你先找到了, 谢谢 你的方案可行 我会兑现的  
    都有分~~呵呵
      

  5.   

     mshtml.IHTMLDocument2 doc = (mshtml.IHTMLDocument2)wb_Blog.Document.DomDocument;