|
-
Jan 15th, 2010, 01:44 PM
#1
Thread Starter
Fanatic Member
VB 3.5 : databinding an object property and modifying another property in code
Hi,
I have this crazy situation:
on a Windows Form, an object myObject is bound to myObjectDataBindingSource like this:
myObjectDataBindingSource .DatSource = myObject
on the form, i have a check box bound to the property: chkProp1 for example of the object: myObjectDataBindingSource
In the code when the checkbox is clicked, I need to go in code and change another text property of the object txtProper2 for example like this:
Private Sub chkProp1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkProp1.CheckedChanged
myObject.txtProper2 = newValue
End sub
The problem is that the event chkProp1_CheckedChanged ends up runing multiple times.
It seems like if I am not allowed to change a second property while a bound property is runing its change event or something like that
Have you ever got some thing similar ? am I supposed to do anything before changing a second property of an object while the change-event of a first property is being executed ?
Thanks
Thanks a lot for your help.
-
Jan 15th, 2010, 02:06 PM
#2
Re: VB 3.5 : databinding an object property and modifying another property in code
is the myObject something that is under your control? Seems to me that if you have a property whose value is dependant on the value of another property, that becomes a business rule, and should be handled by the class, not the UI.
-tg
-
Jan 15th, 2010, 04:05 PM
#3
Thread Starter
Fanatic Member
Re: VB 3.5 : databinding an object property and modifying another property in code
myObject is a business object instance of a class: myClass. This class is implemented (inherits from) CSLA framework. It s a framewok that facilitates business rule, validation, object is dirty, is new.....etc
So there is already logic in the class itslef, but i need sometimes to do stuff in the UI code as well, depending on other UI controls.
Thank you
Thanks a lot for your help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|