Binding Windows Forms Controls to Data in Visual Studio
You can display data to users of your application by binding data to Windows Forms. To create these data-bound controls, you can drag items from the Data Sources window onto the Windows Forms Designer in Visual Studio. This topic describes some of the most common tasks, tools, and classes involved in creating data-bound Windows Forms applications.
For general information about how to create data-bound controls in Visual Studio, see Binding Controls to Data in Visual Studio. For more information about data binding in Windows Forms, see Windows Forms Data Binding.
The following table lists common tasks related to displaying data on a form in a Windows application.
Create data-bound controls.
Bind existing controls to data.
Create controls that display related data in a parent-child relationship: when the user selects a data record in one control, another control displays related data for the selected record.
Create a lookup table. A lookup table displays information from one table based on the value of a foreign-key field in another table.
Format the way that controls display data.
Change the behavior of the smart-captioning feature in the Data Sources window.
Add controls that execute a parameterized query.
Set a column to use an image control to display images in a database.
Filter or sort data in a dataset.
The following topics provide examples of binding Windows Forms controls to data.
Smart tags specific to working with data are available on many controls. When certain controls are added to a form, a set of possible actions that relate to data are available on the smart tag. For more information, see Data Smart Tags.
The BindingSource component serves two purposes. First, it provides a layer of abstraction when binding the controls on your form to data. Controls on the form are bound to the BindingSource component (instead of being bound directly to a data source).
Second, it can manage a collection of objects. Adding a type to the BindingSource creates a list of that type.
For more information about the BindingSource component, see:
This component provides a user interface for navigating through data displayed by a Windows application. For more information, see BindingNavigator Control (Windows Forms).