Let's take another look at what is going on when you bind a control or multiple controls to a set of data on a form. As mentioned earlier, when you create the data bindings, the form itself creates some synchronization objects to manage the fact that you may have multiple controls on the form bound to the same data source, and that you (probably) want them to be synchronized.
The form itself has a BindingContext property that holds a collection of synchronization objects for each data source that is being used for data binding on the form. For the most part in .NET 2.0, you don't have to deal directly with the binding context in your code, but it is still lurking under the covers making things work. (In .NET 1 .X, you had to go through the binding context to get to the synchronization objects for a number of scenarios.) As discussed in the previous section, what gets created behind the scenes are instances of a CurrencyManager for list-based data sources or aPropertyManager for individual custom business objects. Each of these classes derives from BindingManagerBase, which is the type of object reference that theBindingContext is designed to contain. The CurrencyManager is the one you will deal with most often.
A container component (such as a Form or a BindingSource) creates a currency manager for each list-based data source that you specify for a control on a form, and it is added to the binding context for the form. The currency manager keeps track of both the underlying data source that controls are bound to and the controls that are bound to that data. You can use the currency manager to access the underlying data that is bound to controls, determine what the current row or object is, and change that current row and affect all of the controls that are bound to it. The currency manager notifies bound controls when items are added, removed, or changed in the bound collection, and controls can use these notifications to refresh their display of the data source.
Was this article helpful?