Reputation: 49
I'm a beginner in VB, I'm trying to display html page in the webbrowser control. when I copy the full path of the html file, and put in the url properties of the webbrowser control, everything works. However, when I build the exe file and run it in different computer, the html page can not be displayed. I know this has to do with the html file path, I'm trying to find a way to display html page using webbrowser control in any computer.
any help will be great guys.
Upvotes: 1
Views: 6584
Reputation: 1397
This is a little late, but better late then never! Sorry I did not find this sooner! Anyway, instead of adding the file url in the URL property of WebBrowser1, here is what you need to do:
In Form1_Load
add the following code:
Dim appPath As String
appPath = Application.StartupPath
WebBrowser1.Navigate(appPath & "/html-file-name-here.html")
Upvotes: 0
Reputation: 320
Try:
WebBrowser1.Navigate(Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) & "\info.html")
remember to add
Imports System.IO
Upvotes: 1