Displaying Data Overview
You display data to users of your application by binding data to controls on a form. You can create these data-bound controls by dragging items from the Data Sources window onto a form in your Windows application.
There are a several components and processes that should be understood when developing data-bound Windows applications. Below is a summary of the tasks, objects, and dialog boxes involved in creating data-bound Windows applications. For more information, see Windows Forms Data Binding.
The following tasks show the typical process you follow to display data on a form in a Windows application.
Open the Data Sources window
Add a data source to your project
Set the items in the Data Sources window to the controls you want created
Drag items from the Data Sources window onto your form
Format the way controls display data
Once you have created a form that displays data, you might want to do one of the following tasks:
For More Information
Edit the data in the underlying data source
Editing Data in Your Application (keep in mind that changes to data in data-bound controls are automatically written to the dataset, but not automatically saved to the underlying database).
Validate changes made to the data
Save updated data back to the database
Data sources are available to your project as items in the Data Sources Window and can be dragged onto your form to create controls that display the underlying data.
Prior to dragging items from the Data Sources window, you specify the controls to be created by clicking the drop-down list for each table and column and selecting the desired control. For more information, see How to: Set the Control to be Created when Dragging from the Data Sources Window.
You can alter the list of available controls for items in the Data Sources window. For more information, see How to: Add Custom Controls to the Data Sources Window.
TableAdapters are designer-generated components created by Visual Studio. They are used to fill datasets (or more specifically, they are used to load data into the DataTables that make up a dataset and to update the database that the DataTable was filled from). TableAdapters are analogous to strongly typed data adapters; they provide communication between your application and your data. TableAdapters contain the connection and commands, or SQL statements, which are executed against the underlying data store. For more information, see TableAdapter Overview.
Unlike standard data adapters, TableAdapters have the ability to contain multiple queries to fill their associated data tables. You can define as many queries for a TableAdapter as your application requires as long as each query returns data that conforms to the same schema as its associated data table. For more information, see How to: Create TableAdapter Queries.
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 relating 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 indirection when binding the controls on your form to data. Controls on the form are bound to the BindingSource component (as opposed to being bound directly to a data source).
For more information on the BindingSource component, see:
This component provides a user interface for navigating data on a Windows application. For more information, see BindingNavigator Control (Windows Forms).