c# - How do I create an error message if process is not found in C#?
问题描述
Here is an example of what I wrote:
string Proc = "minecraft://";
private void Button_Click(object sender, RoutedEventArgs e)
{
Process.Start(Proc);
}
解决方案
You can use a try-catch
statement for you to know the exception or error that will appear on your code.
try
{
Process.Start(Proc);
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
推荐阅读
- asp.net - ASP.NET MVC5 - 返回部分视图后不执行 RenderPartial()
- algorithm - 如何计算这个细胞的概率是我的
- oracle - Oracle Schema 下每个表的行数和大小
- javascript - 如果未启用原理图,如何将节点模块添加到 Angular 项目?
- http-live-streaming - medialement.js 不适用于我在 iPhone 上的 hls
- python-3.x - 解码 Python 字符串
- python - BurpSuite 上的 POST 请求响应与 Python 不同
- java - 确定文件是否在 Java 中被 PGP 加密
- ios - 如何使单元格中的某些文本或单词不可见或可见?
- go - 如何使用 Golang 获取发布的二进制数据的文件名?