WinFormApplication - system.componentmodel.Win32exception. System cannot find the specified file

Hemanth B 886 Reputation points

Hi, I created a linklabel in my WinForm Application in Visual Studio C#. I added this code for the linklabel so that when ever users click that linklabel, they go to the link:

private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)

But when I run the application, this error pops out: (Refer image below)

I also tried using this code:

private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)

Please help! Is the code above wrong?

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,934 questions
{count} votes

Accepted answer
  1. Timon Yang-MSFT 9,571 Reputation points

    I cannot reproduce this exception, it works fine with me.

    This may be a problem with a specific machine or even a specific software. Try to switch your default web browser or reinstall the current browser.

    You can also try the following code:

    Process.Start(new ProcessStartInfo("") { UseShellExecute = true });  

    When I checked the posts with similar problems, I found that some people solve their problems in this way.

    Process.Start(url) fails

    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

1 additional answer

Sort by: Most helpful
  1. Karen Payne MVP 35,011 Reputation points

    This will work with .NET Core. In this case with Chrome browser, change the first line to match your browser if not Chrome.

    var processes = Process.GetProcessesByName("Chrome");
    var path = processes.FirstOrDefault()?.MainModule?.FileName;
    Process.Start(path, "");
    0 comments No comments