Visual studio form link error C#.

RED_Edem 21 Reputation points
2021-06-09T14:35:17.81+00:00

Hello. :)

I created a button inside the Visual Studio form to which I want to assign a link. I’ve watched a lot of videos, I’ve tried a lot already, but it’s always the same end when I click the button. My program freezes and I get the following error message:

Exception Thrown
System.ComponentModel.Win32Exception: 'The specified file cannot be found.'

How can I fix this? Thanks for the help. :)
103800-sadas.png

Developer technologies C#
0 comments No comments
{count} votes

Accepted answer
  1. Viorel 122.6K Reputation points
    2021-06-10T04:02:41.477+00:00

    Try this approach:

    var psi = new ProcessStartInfo
    {
       FileName = "https://www.google.com/",
       UseShellExecute = true,
    };
    Process.Start( psi );
    
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Timon Yang-MSFT 9,606 Reputation points
    2021-06-10T05:48:48.1+00:00

    What is your default browser?

    Try to specify the browser path, this error may be because the code cannot find your browser.

    ProcessStartInfo info = new ProcessStartInfo(@"C:\Program Files\Internet Explorer\iexplore.exe");  
    

    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.