Data-bound TextBox: can't exit

后端 未结 3 2059
梦谈多话
梦谈多话 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

    In order to fix the validation failure, which is due to the inability of the databinding to set DBNull.Value into the textbox.text, you may add the following line in the Form_Load section:

    TextBox1.DataBindings["Text"].NullValue = string.Empty;
    

    for each text box you want to allow empty value to be validated correctly.

    See more details on Microsoft Connect.

    and on:

    Can't escape empty textbox

提交回复
热议问题