How to do validation while databinding?
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.
精彩评论