开发者

webBrowser failure. Migration VB6 to VB.Net. ExecWB and QueryStatusMethod failure

开发者 https://www.devze.com 2023-04-13 08:25 出处:网络
I want to migrate an application from VB6.0 to VB.net. I migrate it myself and get an error on this two lines. The error says \"ExecWB is not a member of System.Windows.Forms.WebBrowse开发者_如何学Cr\

I want to migrate an application from VB6.0 to VB.net. I migrate it myself and get an error on this two lines. The error says "ExecWB is not a member of System.Windows.Forms.WebBrowse开发者_如何学Cr"!!The same error with the ExecWB Method. I dont find any solution or any equivalent code in .net for that. Do I need an imprt or reference or equivalent type?

Please help.

eQuery = webBrowser.QueryStatusWB(SHDocVw.OLECMDID.OLECMDID_COPY)
webBrowser.ExecWB(SHDocVw.OLECMDID.OLECMDID_PAGESETUP,   
SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DODEFAULT, Nothing, Nothing)

webBrowser?

Thank you


There are two different WebBrowser things, the WebBrowser Object and the WebBrowser Control. The object is the ActiveX version that you were using in VB6 while the control was completely redesigned to follow .Net standards. While there may be some common methods, properties and events between the two they are not really related.

You can continue to use the ActiveX version in .Net just fine if you want. You'll need to add a reference to it either via the Add References menu or by adding the Microsoft Web Browser object to your toolbox. If you want to use the .Net version then you'll need to find the updated way to do your specific tasks.


A 30s Google search returned this article that suggests you can use late binding on the ActiveXInstance property to access the methods directly.

Note that this method is marked as "infrastructure use only" and may well be subject to change/removal, etc at a later date.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号