Opening Default Browser to a specific page

  • Thread starter Thread starter Mike Fellows
  • Start date Start date
M

Mike Fellows

when i click a button i want to open the machines default web browser to a
specific page

how do i do this?


Regards


Michael Fellows
 
Thanks alot for your help guys that worked a treat, excpet you need the URL
in brackets :-)

Mike
 
Just use the following in the Click_Event handler:

System.Diagnostics.Process.Start(URL)

where URL is a string containing the url of the website
that the default browser should open to. For example:

Dim URL As String = "http://www.google.com/"
System.Diagnostics.Process.Start(URL)

If you want to specify the browser to use, say Internet
Explorer, just use the following:

Dim URL As String = "http://www.google.com/"
System.Diagnostics.Process.Start("IExplore", URL)

If you want to specify Mozilla as the browser to use, use
the following code:

Dim URL As String = "http://www.google.com/"
System.Diagnostics.Process.Start("Mozilla", URL)

In fact, you can start any application this way. for
example, to fire up Notepad, use this:

System.Diagnostics.Process.Start("Notepad")

The parameter to pass is simply the name of the
executable file without the .exe extension.

Norm Bell
 
Back
Top