首页 > 解决方案 > 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);
}

标签: c#

解决方案


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);
}

推荐阅读