1 out of 1 rated this helpful - Rate this topic

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.

Task

More information

Create data-bound controls.

Bind existing controls to data.

How to: Bind Windows Forms 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.

How to: Display Related Data in a Windows Forms Application

Create a lookup table. A lookup table displays information from one table based on the value of a foreign-key field in another table.

How to: Create Lookup Tables in Windows Forms Applications

Format the way that controls display data.

Formatting and Advanced Binding Dialog Box

Change the behavior of the smart-captioning feature in the Data Sources window.

How to: Customize How Visual Studio Creates Captions for Data-bound Controls

Add controls that execute a parameterized query.

How to: Add a Parameterized Query to a Windows Forms Application

Set a column to use an image control to display images in a database.

How to: Bind Controls to Pictures from a Database

Filter or sort data in a dataset.

How to: Filter and Sort Data in a Windows Forms Application

The following topics provide examples of binding Windows Forms controls to data.

Walkthrough: Displaying Data on a Windows Form

Provides step-by-step details on querying data from a database and displaying the data on a Windows Form.

Walkthrough: Displaying Related Data on a Windows Form

Provides step-by-step details on displaying data from two related tables and displaying the data on a Windows Form.

Walkthrough: Creating a Windows Form to Search Data

Provides step-by-step details about how to create a Windows Form that conducts a database search based on user input.

Walkthrough: Creating a Lookup Table in a Windows Forms Application

Provides step-by-step details on displaying data from one table that is based on the data that is selected in another table.

Walkthrough: Passing Data Between Windows Forms

Provides step-by-step details about how to pass values from one form to another form in an application.

Walkthrough: Creating a Windows Forms User Control that Supports Simple Data Binding

Provides step-by-step details about how to create a custom control that can be used in the Data Sources window.

Walkthrough: Creating a Windows Forms User Control that Supports Complex Data Binding

Provides step-by-step details about how to create a custom control that can be used in the Data Sources window.

Walkthrough: Creating a Windows Forms User Control that Supports Lookup Databinding

Provides step-by-step details about how to create a custom control that can be used in the Data Sources window.

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.

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

The DataGridView control lets you display and edit tabular data from many different kinds of data sources. You can bind data to a DataGridView by using the DataSource property. For more information, see DataGridView Control Overview (Windows Forms).

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.