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.
Tasks Involved in Displaying Data on a Form in a Windows Application
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
Click Add New Data Source in theand complete the
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:
|Task||For More Information|
Edit the data in the underlying data source
(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 represent the data available to your application and are created by running the. Data sources are created from databases, Web services, or objects. For more information, see .
Data Sources Window
Data sources are available to your project as items in theand 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.
You can alter the list of available controls for items in the Data Sources window. For more information, see.
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 thes 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 .
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.
Data Smart Tags
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.
Thecomponent 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).
Additionally, the BindingSource component can manage a collection of objects. Adding a type to the BindingSource creates a list of that type.
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.
Thecontrol lets you display and edit tabular data from many different kinds of data sources. Binding data to the DataGridView control is accomplished by means of the property. For more information, see .