如何在 VB.NET 中使用 MSHTML? [英] How do I use MSHTML in VB.NET?

查看:27
本文介绍了如何在 VB.NET 中使用 MSHTML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在问题 #56107 的答案中, Erlend 提供了这个示例 c# 代码:

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);

我想在 VB.NET 中使用 mshtml,但 IDE 无法识别:

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

Imports mshtml

在 VB.NET 中使用 MSHTML 还需要采取哪些额外步骤?

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

推荐答案

找到了我自己问题的答案:

Found an answer to my own question:

ASP.NET 中的 MSHTML

如果您有兴趣,这里是基于 VB.NET 的解决方案,您可以使用它ASP.NET(.aspx.vb).确保从 .NET 添加对 Microsoft.mshtml 的引用对象集合和导入 System.Runtime.InteropServices"

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"

根据这个线索,我通过打开添加引用"对话框并查看 COM 选项卡而不是 .NET 选项卡找到了这一点.它的组件名称是 Microsoft HTML Object Library.

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.

这篇关于如何在 VB.NET 中使用 MSHTML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆