开发者

How to do validation while databinding?

开发者 https://www.devze.com 2023-01-14 20:14 出处:网络
How can I do validation and stop databinding when validation failed? for example, if a user type 1234 for a firstName texbox which has the 开发者_开发知识库following binding:

How can I do validation and stop databinding when validation failed?

for example, if a user type 1234 for a firstName texbox which has the 开发者_开发知识库following binding: this.textBoxFirstName.DataBindings.Add("Text", personObj, "FirstName");

Thanks!


Use BindingComplete and/or Parse events of Binding class.

Or use control's validation functionality, which is preferable. Or use some kind of mask editor. Mask editor would be better from the usability point of view.

0

精彩评论

暂无评论...
验证码 换一张
取 消