UI: why BindingSource?

UI: why BindingSource?

Old forum URL: forums.lhotka.net/forums/t/4419.aspx


jh72i posted on Tuesday, February 26, 2008

Simple question: why have bind collections to BindingSource component and then that to UI controls.  What is it exactly that BindingSource gives and why intro this extra level. 

 

JohnB replied on Friday, February 29, 2008

If you intend to use databinding then you will need it.

Per Microsoft:
The BindingSource component serves two purposes. First, it simplifies binding controls on a form to data by providing a layer of indirection, currency management, change notification, and other services. This is accomplished by attaching the BindingSource component to your data source, and then binding the controls on your form to the BindingSource component. All further interaction with the data, including navigating, sorting, filtering, and updating, is accomplished with calls to the BindingSource component.

Second, the BindingSource component can act as a strongly typed data source. Typically the type of the underlying data source is fixed through one of the following mechanisms:

* Use the Add method to add an item to the BindingSource component.
* Set the DataSource property to a list, single object, or type.

Both of these mechanisms create a strongly-typed list. BindingSource supports both simple and complex data binding as indicated by its DataSource and DataMember properties.

Check out this link for all the details.

Copyright (c) Marimer LLC