By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,950 Members | 1,019 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,950 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 vb.net project to open on web broswer.
thanks
Nov 4 '14 #1
Share this Question
Share on Google+
6 Replies


Frinavale
Expert Mod 5K+
P: 9,731
What type of vb.net 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 vb.net to load on my web broser control on my form
Thanks
Nov 5 '14 #4

Frinavale
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"
  3.  
  4. 'The following starts a process that opens the browser specified with the url provided
  5. Process.Start(DefaultBrowserPath, LocalURL)
  6.  
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

Frinavale
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.


-Frinny
Nov 6 '14 #7

Post your reply

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