1

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.

1
  • I tried to use: WebBrowser1.Navigate(App.Path & "\info.htm") but it gives me the error " 'App' is not declared. It may be inaccessible due to its protection level." Commented Mar 31, 2014 at 1:02

2 Answers 2

1

Try:

WebBrowser1.Navigate(Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) & "\info.html")

remember to add

Imports System.IO
Sign up to request clarification or add additional context in comments.

2 Comments

nothing happens, I tried to copy info.html to all possible folders of the application (ex bin, debug ...) but nothing happens
try building application and then copy info.html to Release folder
0

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:

  1. In Form1_Load add the following code:

    Dim appPath As String appPath = Application.StartupPath WebBrowser1.Navigate(appPath & "/html-file-name-here.html")

  2. Change the "html-file-name-here.html" to what your HTML file name is.
  3. Then when you compile your app, just put your html file in the folder where the app is launching from .

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.