|
-
Feb 23rd, 2008, 06:25 PM
#1
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:
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.
-
Feb 23rd, 2008, 07:06 PM
#2
Thread Starter
New Member
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
-
Feb 23rd, 2008, 07:18 PM
#3
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|