OK Computer

Tuesday, October 04, 2005


There is a bug when using databinding between data containers and windows forms elements in combination with and in-between business logic/data validation in .Net 2.0. In a few words the problem arises when e.g. you make a change to a value in, say, a TextBox and the Set-method of the property the value is data-bound to does a custom validation/modification before committing the change to the business object.

Let's say I make a change to myLabel.text, which is databound to your Business Objects (using something similair to: myLabel.DataBinding.Add("Text", this.CustomerBusinessObject, "CustomerName");). CustomerBusinessObject has a property called CustomerName that implements a Set; method that actually updates CustomerBusinessObject's private field m_customerName. So far all is good - untill you start adding custom modification in the Set; method, say;

Set
{
value.Trim();
this.m_customerName = value;
}

What you will see is that any other controls will refresh their display values, if anything to refresh, but the actual edited textbox will not. Read on for a temporary solution as we await a fix for this (probably as a service pack after VS2005 release 7th November) here: Conclusion

Microsoft:

Bugreport

Rockford Lhotka:

Conclusion

Problem first reported

..continued

0 Comments:

Post a Comment

<< Home