无法显示消息框

问题描述 投票:-1回答:1

我有一个“ try catch”,当编译器进入“ catch”时,我想显示一个MessageBox,以便程序不会崩溃或退出。

现在在“ catch”中时,出现错误System.ArgumentNullException:“值不能为空。参数名;键”在MessageBox.Show行上。

enter image description here

enter image description here

错误消息以荷兰语显示(对不起)。

c# wpf try-catch messagebox
1个回答
0
投票
并且要捕获导致应用程序崩溃的未处理的异常,您应该在调试-> Windows->异常设置:中启用选项“ Commomn Language Runtime Exception”:

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.