Binding Data to Controls Overview
The features in this topic are available only if you have the required applications installed.
For more information, see.
Data binding works the same way in Microsoft Visual Studio 2005 Tools for the Microsoft Office System projects as it does in Windows Forms projects. For more information, see.
Displaying Data in Documents
You can use the Data Sources window to add data-bound controls to your documents easily, the same way you use it for Windows Forms. For more information, see.
Visual Studio Tools for Office Controls
In addition to Windows Forms controls, Visual Studio Tools for Office includes Office-specific controls called host controls. You can bind data to these controls the same way you can bind data to Windows Forms controls. For more information, see.
When you perform simple data binding to a host control, such as binding to a FormattingEnabled parameter to true to prevent the
Change event from being raised twice. For example:
<PropertyName>, <DataSource>, <DataMember>,
Updating Data That Is Bound to Host Controls
Data binding between a data source and a host control involves a two-way data update. In simple data binding, changes in the data source are reflected automatically in the host control, but changes in the host control require an explicit call to update the data source. The reason is that in some cases, changes in one data-bound field are not accepted unless they are accompanied by changes in another data-bound field. For example, you might have two fields, one for age and one for years of experience. Experience cannot exceed age. A user cannot update the age from 50 to 25 and then the experience from 30 to 10 unless he or she makes the changes at the same time. To solve this problem, fields with simple data binding are not updated until the updates are explicitly sent by code.
To update a data source from host controls that enable simple data binding, you must send updates to the data source using themethod. This is not needed when you do complex data binding using the control. In that case, changes are automatically sent to the associated data source without requiring additional code.
For more information, see.
Increasing Performance in ListObject Controls
Reading an XML file into a data-bound ListObject control tends to be slower if you bind the control first, and then callto fill the dataset. To improve performance, call ReadXml before you bind the control.
Disconnecting ListObject Controls from the Data Source
After you have filled a ListObject control with data by binding it to a data source, you can disconnect it so that modifications made to the data in the list object do not affect the data source. For more information, see.