Well, your question is: Why does it not update?
The answer is: It cannot, because it does not know when the objects property
changes. How should it know? When you set the objects property you execute a
piece of code you wrote by yourself. So no code gets executed that could
notify the BindingManager (and thus the TextBox) of this change. That's why
you need that ChangedEvent. The BindingManager looks through Reflection for a
Changed-Event with the right name, but if it does not find one, there's not
much it can do (except changing the code of your Property-function, or
polling every few microseconds all bound properties of your class, but you
really would not like the implications of these methods).
It works the other way round, precisely because the TextBox *has* a
TextChanged-Event, so the BindingManager can hook up to it and propagate the
change.
TToni
[quoted text, click to view] "jtwomley" wrote:
> I have a control that has a databinding attached to it like so.
>
> txtName.DataBindings.Add("Text", nameClass, "Name");
> This works great the Name property from nameClass is populated in the
> txtName field
>
> Now I have btnOne. In the click event of btnOne I call
>
> nameClass.Name = "SMITH";
>
> At this point why does the txtName not update?
> I am looking for an answer other than adding the NameChanged EventHandler in
> the nameClass object.
>
> I am working in .net 2.0
>