[英]Load local HTML file into a WebBrowser control from my.resources in the project - vb.net
[英]vb.net how to add and load an html file from resource into webbrowser control
我在form2
上有一個webbrowser
控件,我想做的事情是:
true
,如何將其從資源加載到webbrowser
控件,並使其在webbrowser
可見? 例如:
If dttest.Rows(0).Item(0).ToString = TextBox1.Text Then
webbrowser.navigate(resources and the html name page)
End If
我已經嘗試過webbrowser.navigate
但是我想加載HTML頁面。
這項工作適合我,並且已經過嘗試和測試……我將If
條件排除在外,因為它與您要完成的目標無關。 另外,也無需調用Navigate
因為在設置Uri
它將加載文檔。
Dim filename As String = "test.html"
With Me.WebBrowser1 'Change name to reflect your name
.ScriptErrorsSuppressed = True 'I was getting script errors from site
.Url = New Uri(String.Format("file:///{0}{1}{2}/", System.IO.Directory.GetCurrentDirectory(), "/Resources/", filename))
End With
注意
如果您的html
文件(文件)的“ Copy to Output Directory
未設置為Copy Always
,則需要進行更改。 您可以右鍵單擊html
文件並選擇屬性。 根據需要更改該屬性。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.