Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Displaying Data Overview

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.

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

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

Validating Data

Save updated data back to the database

Saving Data

Data sources represent the data available to your application and are created by running the Data Source Configuration Wizard. Data sources are created from databases, Web services, or objects. For more information, see Data Sources Overview.

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.

NoteNote:

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).

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 BindingNavigator Control (Windows Forms).

The DataGridView control 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 DataSource property. For more information, see DataGridView Control Overview (Windows Forms).

Community Additions

ADD
Show:
© 2015 Microsoft