Data Sources Window
The Data Sources window displays the data sources in your project. Data sources represent the data available to your application. You can use the Data Sources window to create data-bound controls in your user interface by dragging items from the window onto a design surface in your project.
The following illustration shows the Data Sources window. In this example, the window contains a typed dataset named NorthwindDataSet. Each item has a drop-down list that contains the controls you can create when you drag the item to a design surface.
The following table lists some of the tasks you can perform by using the Data Sources window.
|
Task |
More information |
|---|---|
|
Open the Data Sources window. |
|
|
Create and add new data sources to your project. |
How to: Connect to Data in a Database |
|
Remove data sources from the Data Sources window. |
|
|
Create data-bound Windows Forms controls and WPF controls by dragging items from the Data Sources window onto a design surface. |
|
|
Choose which control should be created when you drag an item to a design surface. |
How to: Set the Control to be Created when Dragging from the Data Sources Window |
|
Customize the list of controls that is available for each data type in the Data Sources window. |
|
|
Open datasets for editing in the Dataset Designer. |
You populate the Data Sources window by adding data sources to your project. The Data Sources window can display data sources that are created from databases, services, or objects. For more information, see Data Sources Overview.
To add new data sources to your project, you can use the Data Source Configuration Wizard. For more information, see the following topics:
You can create a new data-bound control or you can add a data binding to an existing control. To create a new data-bound control, drag an item from the Data Sources window onto either the Windows Forms Designer or the WPF Designer. To set up data binding between an existing control and a data source, drag an item from the Data Sources window onto the existing control in the designer. For more information, see Binding Controls to Data in Visual Studio.
For each data type that appears in the Data Sources window, there is a default control that is created when you drag the item to the designer. If you want to create a different control, you can specify the control that will be created before you drag the item onto the designer. For more information, see How to: Set the Control to be Created when Dragging from the Data Sources Window.
The items in the Data Sources window are synchronized with items in your project. If you delete an item from your project, that corresponding items will be removed from the Data Sources window.
For example, if your project has a data source based on a service, removing the service reference from your project also removes the service data source from the Data Sources window. For more information, see How to: Remove Data Sources from the Data Sources Window.