views:

304

answers:

1

I am just learning bindingsources etc. I have added my textbox databindings like so:

txtTitle.DataBindings.Add("Text", bindingNavigator1.BindingSource.Current, "Title");

When the user clicks the next button on the navigator do I have to handle the bindingsource currentitem changed event to say

txtTitle.Text = ((MyObject)bindingsource.CurrentItem).Title??

I would have thought this would be automatic as I have a lot of controls so seems tedious

A: 

You should bind to the bindingsource itself as in:

txtTitle.DataBindings.Add("Text", bindingNavigator1.BindingSource, "Title");

Then you don't need to handle any further events. As you say, that would be tedious.

hawbsl
Thanks, I had already tried that but it errored. Seems ok now...weird!
Jon