Data-bound TextBox: can't exit

后端 未结 3 2028
梦谈多话
梦谈多话 2021-01-18 11:42

I\'ve got a text box bound to an object\'s property (in fact several text boxes) on a form. This for is an editor for an object. When i\'m editing some objects and modify va

3条回答
  •  旧巷少年郎
    2021-01-18 12:03

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

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

    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).

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

提交回复
热议问题