S
Scott Mueller
I have a question about simple binding:
(please forgive any syntax errors... I am at home, where I do not have
Vb.Net installed, and I rely far too much on Vb's intellisense!)
If I have two textboxes, Textbox1 and Textbox2, and add a databinding to
Textbox2 as such:
Textbox2.Databindings.Add("Text",Textbox1,"Text")
Anything typed into Textbox1 is mirrored in Textbox2.
Now suppose I want to bind the text property of Textbox2 to a property in a
class that I've written:
Class TestClass
Private m_StringValue as String
Public Property StringValue() as String
Get
Return m_StringValue
End Get
Set(Value as String)
m_StringValue = Value
End Set
End Property
Sub New(InitialValue as String)
m_StringValue = InitialValue
End Sub
End Class
Running the following code does not produce the results I would expect:
Sub Main
Dim MyClass as New TestClass("Test")
TextBox2.SetDataBindings("Text",MyClass,"StringValue")
MyClass.StringValue = "New Test"
End Sub
The Text property of Textbox2 at the end of this code fragment is still
"Test", not "New Test"
Do I need to implement any interfaces to cause the changes to the
StringValue property to propogate up to the bound textbox?
Thanks in advance!
Scott Mueller
(e-mail address removed)
(please forgive any syntax errors... I am at home, where I do not have
Vb.Net installed, and I rely far too much on Vb's intellisense!)
If I have two textboxes, Textbox1 and Textbox2, and add a databinding to
Textbox2 as such:
Textbox2.Databindings.Add("Text",Textbox1,"Text")
Anything typed into Textbox1 is mirrored in Textbox2.
Now suppose I want to bind the text property of Textbox2 to a property in a
class that I've written:
Class TestClass
Private m_StringValue as String
Public Property StringValue() as String
Get
Return m_StringValue
End Get
Set(Value as String)
m_StringValue = Value
End Set
End Property
Sub New(InitialValue as String)
m_StringValue = InitialValue
End Sub
End Class
Running the following code does not produce the results I would expect:
Sub Main
Dim MyClass as New TestClass("Test")
TextBox2.SetDataBindings("Text",MyClass,"StringValue")
MyClass.StringValue = "New Test"
End Sub
The Text property of Textbox2 at the end of this code fragment is still
"Test", not "New Test"
Do I need to implement any interfaces to cause the changes to the
StringValue property to propogate up to the bound textbox?
Thanks in advance!
Scott Mueller
(e-mail address removed)