Results 1 to 16 of 16

Thread: [RESOLVED] [2008] Launch browser with button click

Hybrid View

  1. #1
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: [2008] Launch browser with button click

    If you want to run the HTML file in the default browser, just execute it with Process.Start:
    vb Code:
    1. Process.Start("someFile.html")
    Me.Close would be the correct way of closing a form yes.
    And no, I dont think theres a simple way of enforcing the browser to allow active content.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  2. #2

    Thread Starter
    New Member
    Join Date
    Feb 2008
    Posts
    11

    Re: [2008] Launch browser with button click

    Thanks. I still have two problems with the code below;
    - it cannot find the index.htm file, I have it in a sub folder of the folder containing the VB project files, do I need to reference it differently?
    - it says I have a syntax error with the Me.close line, does it have to be declared somehow?

    - also, will the user need .Net 3.5 installed on their PC or will this very simple app work with ealier versions (2.0)?

    Code:
    Public Class CD
    
        Private Sub MenuButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuButton.Click
            Process.Start("\site\index.htm")
        End Sub
    
        Me.close
    
    End Class

  3. #3
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: [2008] Launch browser with button click

    1. You need to know the location of the html file relatively to the location of your EXE file. You're most likely running Debug mode now, so the executable of your project will run from the bin/debug path of your project folder.

    2. Me.Close (nor any other method call) line can not be placed outside any method body. Place it underneath the Process.Start() line instead.

    3. You will have to go into the project properties and target a lower framework. The framework youre targetting will be the one the user needs to have installed, no matter how simple the application is.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width