C# 文本框绑定未导致验证
我在一个表单中有两个文本框,在两个文本框C# 文本框绑定未导致验证,c#,winforms,events,data-binding,textbox,C#,Winforms,Events,Data Binding,Textbox,我在一个表单中有两个文本框,在两个文本框validating事件中,我都编写了验证用户输入的代码。。在validated事件中,我根据这两个文本框值更新第三个文本框 在form load中,我绑定文本框以从数据库加载以前的数据..如下所示 this.txtClosingBalance.DataBindings .Add("Text", openingClosingBalance, "ClosingBalance"); 现在的问题是,当数据从数据库绑定时,不会触发验证事件。。第三个文本框
validating
事件中,我都编写了验证用户输入的代码。。在validated
事件中,我根据这两个文本框值更新第三个文本框
在form load中,我绑定文本框以从数据库加载以前的数据..如下所示
this.txtClosingBalance.DataBindings
.Add("Text", openingClosingBalance, "ClosingBalance");
现在的问题是,当数据从数据库绑定时,不会触发验证事件。。第三个文本框未更新
如何解决这个问题?解决方法是什么?如果未触发
验证
事件,请在执行绑定时自行调用该事件:
this.txtClosingBalance.DataBindings.Add("Text", openingClosingBalance,
"ClosingBalance");
textBox_Validating(textBox, null);
如果未触发
验证
事件,请在执行绑定时自行调用该事件:
this.txtClosingBalance.DataBindings.Add("Text", openingClosingBalance,
"ClosingBalance");
textBox_Validating(textBox, null);