|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
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 theonto 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.
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) 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.)
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.
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).
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.
To set the overall layout of the entire table
In the Data Sources window, select the table or object to set.
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.
Your form must be opened in the designer for the control-list drop-downs to appear in the Data Sources window.
Sepcify 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
In the Data Sources window, expand the desired table or object type to display its columns or properties.
Select each column or property to change. From the item's control list, select the control to be created when dragged onto a form.
A form must be opened in the designer for the control list drop-downs to appear in the Data Sources window.