How to: Display Data in Individual Windows Forms Controls

You display data on Windows Forms in individual controls by dragging objects from the Data Sources Window onto a form. Prior to dragging from the Data Sources window, set the control type of the table to Details (individual controls). For more information, see How to: Set the Control to be Created when Dragging from the Data Sources Window.

If the controls needed by your application are not available from within the Data Sources window, you can add controls using the Data UI Customization, Windows Forms Designer, Options Dialog Box. For more information, see How to: Add Custom Controls to the Data Sources Window.

An alternative is to display the data in a grid. For more information, see How to: Display Data in a Windows Forms DataGridView Control.

Note

This page tells how to create new controls that display data on a form. You can also bind existing controls to data by dragging items directly onto them. For more information, see How to: Bind Data to Existing Controls.

Displaying an Entire Table of Data in Individual Controls

You can display an entire table of data in individual controls by dragging the table (or a node representing a collection if you are using an object data source) from the Data Sources window onto a form in a Windows application.

To display an entire table of data

  1. Open the Data Sources window. For more information, see How to: Open the Data Sources Window.

    Note

    If the Data Sources window is empty, add a data source to it. For more information, see Data Sources Overview.

  2. Open the form in the Windows Forms Designer.

  3. Select a table in the Data Sources window, click the drop-down arrow, and then select Details.

  4. Drag the table from the Data Sources window onto a form.

    An individual data-bound control for each column or property is created on the form, accompanied by an appropriately titled Label control.

Displaying Selected Columns of Data in Individual Controls

Display individual columns of data in individual controls by dragging the individual columns (or properties if you are using an object data source) from the Data Sources window onto a form in a Windows application.

To display select columns of data

  1. Open the Data Sources window. For more information, see How to: Open the Data Sources Window.

    Note

    If the Data Sources window is empty, add a data source to it. For more information, see Data Sources Overview.

  2. Expand the table to display the individual columns.

    Tip

    To set the control that is created for each column, select the column in the Data Sources window, click the drop-down arrow, and select a control from the list of available controls. For more information, see How to: Set the Control to be Created when Dragging from the Data Sources Window.

  3. Open the form in the Windows Forms Designer.

  4. Drag the desired columns from the Data Sources window onto a form.

    For each column or property you drag, an individual data-bound control is created on the form, accompanied by an appropriately titled label control.

See Also

Tasks

Walkthrough: Displaying Data on a Form in a Windows Application

Concepts

Dataset Designer

Reference

BindingSource Component Overview

BindingNavigator Control Overview (Windows Forms)

Other Resources

Connecting to Data in Visual Studio

Preparing Your Application to Receive Data

Fetching Data into Your Application

Displaying Data on Forms in Windows Applications

Editing Data in Your Application

Validating Data

Saving Data

Data Resources