Hello everyone,
VB2003-Winforms
I have a class object (testclass), that I would like to bind parts of to two
custom controls (control1 and control2). The testclass is stored in a hash
table for the life of the client session. Upon first run (Creation of
testclass), the bindings work fine and everyone is happy. However, if I
were to open the testclass again, and bind to my controls again, the
underlying controls (i.e. textboxes) will not release focus. The data is
bound correctly, and reflects the changes that I have made initially. If I
close the form with the terminate x in the top right corner, the data is
stored, I just cannot select another control once I change the data in one
control. I always create a new instance of the form that I will perform the
binding in and dispose of it once it closes.
Control1 is a simple control with two radioboxes on it, (OptionA, OptionB)
and I expose a property SelectedOption. The second control has four
textboxes on it (txtValue1a,txtValue1b,txtValue2a,txtValue2b). Two of them
are visuable based on the selected option.
Anyone have any ideas on where to begin looking?
The binding logic looks like:
public sub Init(byValue objClass as TestClass)
dim b as binding
'Bind to the options selection control
b=new binding("SelectedOption",objTestClass,"SelectedOpt ion")
me.control11.databindings.add(b)
'Notify the second control of changes in options
me.control11.control2 = me.control21
'Bind to the values control
'This is the property used for optionA
b=new binding("Text",objTestClass,"Value1A")
me.control21.txtValue1a.databindings.add(b)
b=new binding("Text",objTestClass,"Value1B")
me.control21.txtValue1b.databindings.add(b)
'This is the property used for optionB
b=new binding("Text",objTestClass,"Value2A")
me.control21.txtValue2a.databindings.add(b)
b=new binding("Text",objTestClass,"Value2B")
me.control21.txtValue2b.databindings.add(b)
end sub