需要帮助跟踪一个奇怪的问题的由来 [英] Need help tracking the origin of a weird problem
问题描述
我工作的一个应用程序与数据库的工作。每当我创造我的应用程序多个数据表中,然后删除一个,然后尝试关闭应用程序,也不会关闭。我添加了一个事件处理程序的FormClosing
事件和取消
属性 FormClosingEventArgs
是真
。如何跟踪这哪里是属性被设置为真
?
I'm working on an app that works with databases. Whenever I create more than one data table in my app, then erase one, and then try to close the app, it won't close. I added an event handler to the FormClosing
event, and the Cancel
property of FormClosingEventArgs
is true
. How can I track where is this property being set to true
?
推荐答案
本方案通常是由被卡在验证表单上的控件之一造成的。如果你正在处理的任何控制确证
事件,并设置 e.Cancel = TRUE
在处理该事件,那么初始值取消
财产的处理程序的FormClosing
也将是真
。
This scenario is usually caused by one of the controls on your form being stuck in validation. If you are handling the Validating
event on any controls and you set e.Cancel = true
in the handler for that event, then the initial value of the Cancel
property in the handler for FormClosing
will also be true
.
如果,一次偶然的机会,你的数据库的应用程序正在使用的DataGridView
控制,其中一个单元格仍可能在编辑模式下,当你来到关闭的形式。
If, by chance, your database app is using a DataGridView
control, one of the cells may still be in edit mode when you come to close the form.
这篇关于需要帮助跟踪一个奇怪的问题的由来的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!