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.

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.

Task

More information

Open the Data Sources window

How to: Open the Data Sources Window

Add a data source to your project

Click Add New Data Source in the Data Sources Window and complete the Data Source Configuration Wizard

Set the items in the Data Sources window to the controls you want created

How to: Set the Control to be Created when Dragging from the Data Sources Window

Drag items from the Data Sources window onto your form

Format the way controls display data

Formatting and Advanced Binding Dialog Box

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

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 Window

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.

Note

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

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.

TableAdapter Queries

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.

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 Data Smart Tags.

BindingSource Component

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:

BindingNavigator Control

This component provides a user interface for navigating data on a Windows application. For more information, see BindingNavigator Control (Windows Forms).

DataGridView Control

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

See Also

Tasks

Walkthrough: Displaying Data on a Form in a Windows Application

Walkthrough: Creating a User Control that Supports Simple Data Binding

Walkthrough: Creating a User Control that Supports Complex Data Binding

Walkthrough: Creating a User Control that Supports Lookup Databinding

Concepts

What's New in Data

Dataset Designer

Data Sources Overview

Reference

Data Sources Window

Other Resources

Data Walkthroughs

Displaying Data on Forms in Windows Applications