Skip to main content
 首页 » 编程设计

c#之无法从字符串转换为 System.Diagnostics.ProcessStartInfo C#

2024年02月06日23emanlee

我已经在 compact framework 3.5 中创建了我的程序,我正在尝试使用以下代码在我的程序中打开一个 html 文件:

string path = @"Help\index.html"; 
System.Diagnostics.Process.Start(path); 

但是我收到以下错误:

Argument '1': cannot convert from 'string' to 'System.Diagnostics.ProcessStartInfo'

有人可以告诉我我做错了什么吗?

请您参考如下方法:

你的代码对我有用;但是,您可以尝试以下代码:

System.Diagnostics.ProcessStartInfo p = new System.Diagnostics.ProcessStartInfo(path);  
System.Diagnostics.Process.Start(p); 

或者,您可以尝试:

Process.Start("chrome.exe", path);