
Databinding -- need a Smart person!
Someone has to know how to fix this...
I created an object called Entity, which has a property
called Name. I then created an instance of this class,
called oEntity. I am trying to bind the .Name property to
a textbox control (called txtName) on a form. I thought I
had it figured out, but it just aint quite workin. I was
able to bind it with code in form_load as follows:
txtName.DataBindings.Add(New Binding("Text",
oEntity, "Name"))
This works fine. If oEntity.Name contains a value, it
will appear in the control when the form is loaded. If I
then edit the value in the control, oEntity.Name is
updated to reflect whatever the control contains. So far,
so good. The problem occurs when I then change the
oEntity.Name property via code. When I do this, for
instance:
oEntity.Name = "Test"
I cannot get the control to recognize the changed
value. After setting oEntity.Name = "Test", I interrogate
txtName.Text and it does not reflect the new value of
oEntity.Name.
What have I done wrong?
Thanks much for your help!
-jd