Export (0) Print
Expand All

How to: Update a Data Source with Data from a Host Control

Note Required applications

The features in this topic are available only if you have the required applications installed.

For more information, see Features Available by Product Combination.

  • One of these development environments:

    VSTO 2005

    -or-

    Visual Studio Team System

  • Microsoft Office 2003

The host controls that enable simple data binding require that you use the WriteValue method for each control to send updated data to the in-memory data source. If the end user navigates away from the host control, WriteValue is not called automatically.

To send changes that have been made in memory using WriteValue to the backend data source, call Update on the TableAdapter. If the end user changes a record and does not navigate away from the control, then your code must call WriteValue before calling Update.

You do not need to call WriteValue when you do complex data binding using the ListObject control. The ListObject control automatically sends changes to the data source without requiring additional code.

For more information about host controls, see Host Items and Host Controls Overview.

To update a dataset from a BindingSource

  • Call WriteValue for the control. This example assumes that you have a NamedRange control named NamedRange1 with its Value2 property bound to a field in a data source.

    this.namedRange1.DataBindings["Value2"].WriteValue();
    
    

See Also

Community Additions

ADD
Show:
© 2014 Microsoft