列表视图鼠标单击事件错误 C#

本文关键字:错误 事件 单击 视图 鼠标 列表 | 更新日期: 2023-09-27 18:35:23

我有一些代码,可以将URL放入ListView。lmb 单击后,我有错误:

"The system cannot find the file specified". 

怎么了?法典:

private void listView2_MouseClick(object sender, MouseEventArgs e)
    {
         try
         {
             string[] link = new string[] { listView2.SelectedItems[columnHeader1.Index].Text};  
             Process.Start(link.ToString().Trim()); 
         }
         catch (Win32Exception ex)
         {
             MessageBox.Show("An error has occured: " + ex.Message);
         }
    }

列表视图鼠标单击事件错误 C#

这是一个特定于计算机的问题,根据您的默认浏览器,它可能会也可能不会起作用。

您可能需要检查默认浏览器集并使用它来启动 URL。

我相信这篇文章会有所帮助:

http://www.seirer.net/blog/2014/6/10/solved-how-to-open-a-url-in-the-default-browser-in-csharp