How do I use MSHTML in VB.NET?

老子叫甜甜 提交于 2019-12-23 11:53:46

问题


In the answer to question #56107, Erlend provided this sample c# code:

using mshtml;
...
object[] oPageText = { html };
HTMLDocument doc = new HTMLDocumentClass();
IHTMLDocument2 doc2 = (IHTMLDocument2)doc;
doc2.write(oPageText);

I'd like to use mshtml in VB.NET, but the IDE doesn't recognize this:

Imports mshtml

What additional steps do I need to take to use MSHTML in VB.NET?


回答1:


Found an answer to my own question:

MSHTML in ASP.NET

If you are interested, here is the solution based on VB.NET which you can use with ASP.NET(.aspx.vb). Make sure you add reference to Microsoft.mshtml from the .NET objects collection and "Imports System.Runtime.InteropServices"

With this clue, I found this by opening the "Add Reference" dialog, and looking under the COM tab, not the .NET tab. It's Component Name was Microsoft HTML Object Library.




回答2:


Imports System.Runtime.InteropServices and

"With this clue, I found this by opening the "Add Reference" dialog(project==>Add Reference), and looking under the COM tab, not the .NET tab. It's Component Name was Microsoft HTML Object Library."

it work 100%



来源:https://stackoverflow.com/questions/550479/how-do-i-use-mshtml-in-vb-net

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!