WebBrowser1.Document 不能转换成 mshtml.HTMLDocument
Dim doc As mshtml.HTMLDocument
doc = WebBrowser1.Document
错误提示:
Unable to cast object of type 'System.Windows.Forms.HtmlDocument' to type 'mshtml.HTMLDocument'.
开发环境 vb.net 2005
相关资料查找及背景介绍:
我以前用vb写的分析网页的代码,WebBrowser1 和 mshtml配合的很好,现在想把它用vb.net 2005重写,第一步就被卡住了如果我使用 System.Windows.Forms 命名空间中的HTMLDocument(System.Windows.Forms.HtmlDocument )
就没有这个类型转换问题。但是System.Windows.Forms 命名空间中的类型太少,比如我要对表格进行控制,他就没有IHTMLTable类型。
我用各种方法进行搜索收获不大,只得到一点提示,说是 .net 中的COM是unmanged代码不能直接使用,mshtml正是COM。
http://www.zhuye123.com/Article/156/161/2006/2006042328784.html
http://www.evget.com/article/read_1061.aspx
就是没有找到解决办法,请高手指点。。
谢过!!!