vb.net 如何在visual basic 2010中通过Web浏览器从嵌入式资源加载.html文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21607398/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 16:41:47  来源:igfitidea点击:

How to load .html file from embedded resources by web browser in visual basic 2010

htmlvb.netvisual-studio-2010visual-studiovisual-studio-2008

提问by Anson Tan

Visual Basic 2010

Visual Basic 2010

I try this

我试试这个

myWebBrowser1.Navigate(My.Resources.HomePage)

myWebBrowser1.Navigate(My.Resources.HomePage)

but it fail to execute it show "Value does not fall within the expected range."

但它无法执行它显示“值不在预期范围内”。

PS : HomePage is a .html file, I add it to the project resources.(embedded)

PS : HomePage 是一个.html文件,我把它添加到项目资源中。(嵌入)

Please help me ~

请帮帮我~

回答by Allan

Something like this:

像这样的东西:

VB code:

VB代码:

Private Sub DisplayHtml()
  Me.WebBrowser1.Navigate("about:blank")
  Me.WebBrowser1.Document.Write(String.Empty)
  Me.WebBrowser1.DocumentText = My.Resources._Readme
End Sub

you can use this as reference to your problem:

您可以将其用作您的问题的参考:

http://weblogs.asp.net/gunnarpeipman/archive/2009/08/15/displaying-custom-html-in-webbrowser-control.aspx

http://weblogs.asp.net/gunnarpeipman/archive/2009/08/15/displaying-custom-html-in-webbrowser-control.aspx