抛出新的异常(“测试”);不扔我的文字

时间:2017-07-06 09:13:28

标签: c# try-catch throw unhandled-exception

throw new Exception("Test");

只有投掷 Window

我无法在那里收到我的文字......

我也试过

throw new ArgumentException("Test");

并使用try catch且没有。

但这是我写的窗口。

编辑: 我正在努力,所以投掷不可能。

1 个答案:

答案 0 :(得分:1)

您需要catch例外并提取要显示的消息。

try
{
     //Your code here
}
catch(Exception e)
{
     var message = e.Message;
     MessageBox.Show(message);
}
相关问题