Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Opening default web browser

I am using the function below to open the user's default web browser.

 Public Function ShowHelp(ByVal url As String) As System.Diagnostics.Process
    Dim startInfo As New Diagnostics.ProcessStartInfo()
    startInfo.FileName = url
    startInfo.WindowStyle = ProcessWindowStyle.Maximized
    Return System.Diagnostics.Process.Start(startInfo)
 End Function

A couple of times the function returned the error (on users machine) "the system cannot find the file specified"

I guess the user has not set a default web browser. Why i get this error? How could i add a default web browser check before calling this function?

like image 684
OrElse Avatar asked Mar 25 '26 23:03

OrElse


1 Answers

 Private Sub helpRichTextBox_LinkClicked(ByVal sender As Object, ByVal e As System.Windows.Forms.LinkClickedEventArgs) Handles helpRichTextBox.LinkClicked
        System.Diagnostics.Process.Start(e.LinkText)
    End Sub
like image 161
Geoffrey Avatar answered Mar 27 '26 22:03

Geoffrey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!