且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

数据绑定文本框:无法退出

更新时间:2023-10-10 09:35:46

听起来像是数据验证问题.检查表单上的控件是否将其 CausesValidation 属性设置为 true 或 false.

Sounds like a data validation issue. Check if the controls on the form have their CausesValidation properties set to true or false.

还要检查表单上的 AutoValidate 属性.它可能设置为 EnablePreventFocusChange(这是默认设置).

Also check the AutoValidate property on the form. It is probably set to EnablePreventFocusChange (which is the default).

也可能是文本框中提供的值无法转换为它在源数据对象上绑定的属性的类型.我相信 Convert 类用于此目的(尽管我在这里可能错了).

It may also be the case that the value being supplied in the text box can not be converted to the type of the property it is bound to on the source data object. I believe the Convert class is used for this (though I may be wrong here).

您可能想查看 MSDN 上的这篇文章winforms 验证的一些细节.

You may want to check out this article on MSDN that covers winforms validation in some detail.