Open a URL from Windows Forms

前端 未结 6 1028
小蘑菇
小蘑菇 2020-11-27 06:35

I\'m trying to provide a link to my company\'s website from a Windows Form. I want to be well behaved and launch using the user\'s preferred browser.

What is the be

6条回答
  •  一向
    一向 (楼主)
    2020-11-27 06:48

    For those getting a "Win32Exception: The System cannot find the file specified"

    This should do the work:

    ProcessStartInfo psInfo = new ProcessStartInfo
    {
       FileName = "https://www.google.com",
       UseShellExecute = true
    };
    Process.Start(psInfo);
    

    UseShellExecute is descriped further here

    For me the issue was due to the .NET runtime as descriped here

提交回复
热议问题