Html open on web broswer in vb .net

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • paulodiol
    New Member
    • Nov 2014
    • 5

    #1

    Html open on web broswer in vb .net

    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
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    What type of vb.net project are you developing?
    A desktop application or a web application?

    Comment

    • paulodiol
      New Member
      • Nov 2014
      • 5

      #3
      Destop application using web form with web broswers

      Comment

      • paulodiol
        New Member
        • Nov 2014
        • 5

        #4
        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

        Comment

        • Frinavale
          Recognized Expert Expert
          • Oct 2006
          • 9749

          #5
          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:
          Code:
          Dim BrowserPath As String '= get the path to the browser that you want to open
          Dim LocalURL As String '= the path to the html file you want to open...for example: = "file:///C:/users/userName/desktop/index.html"
          
          'The following starts a process that opens the browser specified with the url provided
          Process.Start(DefaultBrowserPath, LocalURL)

          Comment

          • paulodiol
            New Member
            • Nov 2014
            • 5

            #6
            Thanks the Path on the html file is block like these?
            C:\Users\SAMPA Technology\Docu ments\Visual Studio 2012\Projects\T esting Problems\Testin g Problems\Testin gPage.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?

            Comment

            • Frinavale
              Recognized Expert Expert
              • Oct 2006
              • 9749

              #7
              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

              Comment

              Working...