Really simple question!!

Ok this is much more simple than my last question about iterating through all pictureboxes on a form!! How do you launch a web page in the user's default browser from a piece of VB.NET code In GML (the programming language I'm actually decent in) you use the shell function, but in VB.NET, this doesn't appear to work!!

Thanks in advance!

-Javawag



Answer this question

Really simple question!!

  • dib56115

    Dustins  will work as long as:

     

    1:) You're conected to the net

    2.) The url is there and there are no errors

    When there are errors....

     

    Your program is going to have exceptions and break. My method wouldn't. You make your choices and live with them.

     

     



  • pankaj sharma103086

    hey ReneeC , can you help, am dying to know how to make my personal browser run as defult am stuck on this, :(
  • Jan Ferneman

    Is there any way of launching the browser and setting the http referrer so that the website can pick up the fact that it was linked to via the application
  • njf

    Yay! it worked fine!! Thanks Dustin

    As for the really long code from ReneeC, it probably would work too but I'm too lazy seeing as Dustin's worked perfectly

    Thanks again people,

    -Javawag


  • John Carroll

     Protected Sub CreateProcess(Byval Filespec as string, Byval Switches as string, optional Byval RunDir as string = "")
         
            Dim startinfo As New System.Diagnostics.ProcessStartInfo
            Dim Proc As New System.Diagnostics.Process

            startinfo.FileName = FileSpec

            If Switches <> "" Then
                startinfo.UseShellExecute = True
                startinfo.Arguments = Switches
            Else
                startinfo.UseShellExecute = False
            End If

           
            startinfo.WorkingDirectory = RunDir
            Proc.StartInfo = startinfo

            Try
                Proc.Start()
            Catch e As Exception
                MsgBox("You have requested to run file:" & vbCrLf & vbCrLf & packet.sFileSpec & vbCrLf & _
                vbCrLf & "However that file is not in that directory.", MsgBoxStyle.Critical, e.Message)
            End Try

        End Sub



  • ElisabetdW

     

    Phewwwwww ... had I been 60 seconds later... I'd have been embarassed... again! ;)



  • Anas Bahsas

    i think you talking about the thing i done before,

    make new project in vb express or C+

    add browser

    go to pro section and set the right url to http://yoursite.com

    maybe this you after


  • Micael Baerens

    You can also do it the lazy way.  One line of code...

    Process.Start("http://forums.microsoft.com")


    Dustin.


  • Really simple question!!