这是我的简单代码,但由于某种原因,它给我抛出了一个异常
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start("chrome", "https://www.google.com/");
}
例外:
System.ComponentModel.Win32Exception: 'The system cannot find the file specified.'
我不明白为什么会这样
要使用WinForms的linkLabel组件打开url,请执行
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start("http://www.url.com"); // will automaticaly redirect the user to his default web browser
}
在官方文档中查找更多信息
看看那里:已经回答的问题
祝你好运。