If I understand correctly, you have TextBoxA bound to PropertyA (on the
entity via the binding source) and when a change occurs in TextBoxA you're
calculating a value and assigning it to TextBoxB - so TextBoxB is NOT bound
to any property of the entity.

 

If that's true then I would make sure that I'm binding on value changes and
not when exiting TextBoxA for starters. The default is to do so on exit.
That's dumb. Secondly I'd look for changes in the entity via "PropertyA"
from the notified property change and then calculate TextBoxB. This way you
know the binding is working and you're also able to perform updates on the
entity in any part of your code and the UI still works.

 

An alternative approach is to either add a new PropertyB to the entity,
perform the calculation in the entity, and just do binding to the UI. If you
can't add a new property then creating an adapter class is the way to go.

 

Cheers.

 

James.

 

From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com]
On Behalf Of Anthony
Sent: Tuesday, 4 May 2010 21:52
To: 'ozDotNet'
Subject: Changing bound fields

 

I have some controls bound to a BindingSource control.

 

I want to do a calculation when the value changes  in one control and set
the result on another control.

 

What is the standard way to do this?   BindingSource is bound to an Entity

 

Question 1  : Do i update the textbox the property is bound to or do i
update the underlying entity which would update the control anyway(i hope)?

 

When i change textbox A...textbox B is updated with the new calculated
result..this works fine...but i have noticed that when i Leave textbox
A..textbox B reverts back to its original value...what is going on here!

 

Is your website <http://www.intellixperience.com/signup.aspx>  being
IntelliXperienced?
regards
Anthony (*12QWERNB*)

Is your website being IntelliXperienced?

 

 

Reply via email to