desmondtan Posted March 15, 2003 Posted March 15, 2003 Does anyone knows how to open a HTML page in browser when user click a button ? Quote
Leaders quwiltw Posted March 15, 2003 Leaders Posted March 15, 2003 Private Sub btnLaunch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLaunch.Click System.Diagnostics.Process.Start("iexplore.exe", "http://www.google.com") End Sub Quote --tim
desmondtan Posted March 17, 2003 Author Posted March 17, 2003 What if the HTML page is not a web address , HTML we page.( e:g help.html) Quote
Leaders quwiltw Posted March 17, 2003 Leaders Posted March 17, 2003 Then you'd do the same thing. The argument that iexplore.exe accepts it a URL which doesn't have to use http. Just provide the file path and it should work. Quote --tim
desmondtan Posted March 20, 2003 Author Posted March 20, 2003 Yes. it works ! thank you very much. Another questions , what if we want to execute a batch file ? waht we should replace the "*iexplorer.exe" in syntax. Quote
*Experts* Nerseus Posted March 20, 2003 *Experts* Posted March 20, 2003 Just use the Start method with on param, as in: System.Diagnostics.Process.Start("http://www.google.com") System.Diagnostics.Process.Start("c:\test.bat") (You might need to double up on the backslashes, can't remember if VB needs that or just C#). In the first line, the command will open Google in whatever the default browser is. This is preferred over using the name "iexplore.exe" in case that name changes or in case the user just hates IE and loves netscape. The second line just executes the file - can be EXE, COM, VBS, WSH, BAT, etc. - they're all considered executables, in a fashion. -Nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.