Hi all,
I'm having some issues with the binding operation for my user control.
I have created a user control class in my Windows Forms Application in vb .net (it does not inherits from any control) and it has different properties. Then I have my objects with their attributes.
My control has different standard controls on it: Textboxes, ComboBoxes, Labels. Several attributes of these controls are bounded to attributes in my objects and that's working ok.
When I bind a property of my user control to an attribute, it works ok. But when I bind a second property of the same user control to a different attribute, it doesn't work. The first one I bounded keeps working, but the second one doesn't. Only the first one bounded works. I'm not getting any devtime nor runtime error, it just does not work. I tried binding the one that doesn't work 2 times and, as expected, I get the runtime error.
I'm binding like this:
Property = "UserControlProperty1Name" Attribute = "MyObjectAttribute1" MyUserControlInstance.DataBindings.Add(New Binding(Property, MyObject.ChildList(Index), Attribute)) Property = "UserControlProperty2Name" Attribute = "MyObjectAttribute2" MyUserControlInstance.DataBindings.Add(New Binding(Property, MyObject.ChildList(Index), Attribute))
Doing it only once (no matter if I try the first or the second one) works properly and property gets bounded to the attribute.
Can you figure out what I'm doing wrong? I've tried several options like WriteValue(), refresh, and obviously, I've googled a lot without success.
Thanks in advance!
Matías.