By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,948 Members | 1,100 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,948 IT Pros & Developers. It's quick & easy.

Html open on web broswer in vb .net

P: 5
i will like if any one can help with the code to open html file on project to open on web broswer.
Nov 4 '14 #1
Share this Question
Share on Google+
6 Replies

Expert Mod 5K+
P: 9,731
What type of project are you developing?
A desktop application or a web application?
Nov 4 '14 #2

P: 5
Destop application using web form with web broswers
Nov 5 '14 #3

P: 5
Am trying to load html file which was on my project file in to load on my web broser control on my form
Nov 5 '14 #4

Expert Mod 5K+
P: 9,731
Have you looked into using the WebBrowser Class?

That will display the HTML file in an embedded browser within your application.

If you are not looking for an embedded solution and want to open it in a web browser on the user's computer you will need to shell out the process to the browser application.

For example:
Expand|Select|Wrap|Line Numbers
  1. Dim BrowserPath As String '= get the path to the browser that you want to open
  2. Dim LocalURL As String '= the path to the html file you want to open...for example: = "file:///C:/users/userName/desktop/index.html"
  4. 'The following starts a process that opens the browser specified with the url provided
  5. Process.Start(DefaultBrowserPath, LocalURL)
Nov 5 '14 #5

P: 5
Thanks the Path on the html file is block like these?
C:\Users\SAMPA Technology\Documents\Visual Studio 2012\Projects\Testing Problems\Testing Problems\TestingPage.html

if i copy the path to the web broswer url its will open properly on my system. but if i copy the application to another computer it will not show the html file.
please what cal do?
Nov 5 '14 #6

Expert Mod 5K+
P: 9,731
Is this a shared HTML file?

Or will it be deployed locally whenever you supply the application (for example: an HTML file that contains help for the application)?

If it is going to be deployed locally then just use the application path when generating the URL for the browser.

If it isn't...and you need this to be accessible from all computers, I recommend publishing the HTML document so that all applications can supply the same URL to the file.

You could deploy the file online (the internet) if it is not sensitive (you will need to either know the IP of the server hosting it or you will need to purchase a domain name for the URL).

Or if your software is going to be executed on an intranet configuration then you could set up one of the computers on the network as a web server and the url would be changed to the computer name (if your network supports domain name resolution) or the IP of the web server computer.

Nov 6 '14 #7

Post your reply

Sign in to post your reply or Sign up for a free account.