问题描述
我想从对话框未处理的异常中禁用退出按钮
像这样的消息:
您的应用程序中发生了未处理的异常.如果您单击继续,则应用程序将忽略此错误并尝试继续.如果单击退出",该应用程序将立即关闭.
我不需要退出按钮,我想禁用它.
谢谢
I want to disable quit button from dialog unhandled exception
Message like this:
unhandled exception has occurred in your application. if you click continue, the app will ignore this error and attempt to continue. If you click Quit, the app will close immediately.
I don''t need quit button and I want to disabled it.
Thanks
推荐答案
try
{
//your code here...
}
catch(Exception ex)
{
Button1.Enabled = false;
}
如果这解决了您的问题,请标记为答案
-Eduard
Please mark as answer if this solved your problem
-Eduard
Try
'Your code goes here
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
如果您不希望出现任何错误消息,请不要在Catch节中编写任何内容,它只会忽略该错误并运行更多代码.:)
但请始终记住,这不是一个好的编程方法:(.您的代码应该没有错误.
If you don''t want any message on error then don''t write anything in Catch Section.It will simply ignore the error and run further code.:)
But always remember that this is not good programming :(.Your code should be error free.
这篇关于禁用对话框中的退出按钮未处理的异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!