Share via


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

You can create data-bound controls by dragging items from the Data Sources Window onto a form in your Windows application. Prior to performing the drag operation, set the controls to be created on the form by selecting a control from each item's control list.

Note

Each bindable item in the Data Sources window has a control list that is accessed by selecting the item and then clicking the drop-down arrow attached to the item.

There are two settings that determine the layout of your data:

  • First, you set the main layout for a table by choosing between displaying the entire table in one control (for example, a DataGridView) or displaying each column in a separate control.

  • Second, if you want to display items in separate controls, select the individual control to be created for each item. (Each item has a default control that is used if no specific control is selected.)

    Note

    You can change the list of available controls for each item in the Data Sources window by selecting Customize from the contol list on any item in the window. For more information, see How to: Add Custom Controls to the Data Sources Window.

Specify Whether to Create a DataGridView or Individual Controls

Prior to dragging tables from the Data Sources window, set the overall layout to display the entire table in one control (DataGridView) or to display each column in a separate control (Details).

Note

This list may appear differently if you have already customized the list by modifying the associated controls. For example, if you have created a custom control that supports complex data binding, then it may show up in the table's control list. For more information, see Walkthrough: Creating a User Control that Supports Complex Data Binding.

To set the overall layout of the entire table

  1. In the Data Sources window, select the table or object to set.

  2. From the table or object's control list, choose DataGridView to specify that you want to create a data-bound DataGridView control, or choose Details to specify that you want to create individual data-bound controls.

    Note

    Your form must be opened in the designer for the control-list drop-downs to appear in the Data Sources window.

Specify the Individual Controls Associated with Columns or Properties

Prior to dragging columns or properties from the Data Sources window onto your form, set the control to be created from the control list associated with each item.

To set the type of individual columns

  1. In the Data Sources window, expand the desired table or object type to display its columns or properties.

  2. Select each column or property to change. From the item's control list, select the control to be created when dragged onto a form.

    Note

    A form must be opened in the designer for the control list drop-downs to appear in the Data Sources window.

See Also

Tasks

Walkthrough: Displaying Data on a Form in a Windows Application

How to: Add Custom Controls to the Data Sources Window

Concepts

What's New in Data

Displaying Data Overview

Dataset Designer

Data Sources Overview

Reference

Data Sources Window

Other Resources

Data Walkthroughs