How to: Bind Data Returned by a Service
You can bind data returned by a Windows Communication Foundation (WCF) service to a control just as you can bind any other data source to a control. When you add a reference to a WCF service, if the service contains composite types that return data, they are automatically added to the Data Sources window.
To bind a control to single data field returned by a WCF service
On the Data menu, click Show Data Sources. The Data Sources window will appear.
In the Data Sources window, expand the node for your service reference. Any composite types returned by the service will be displayed.
Expand a node for a type. The data fields for that type will be displayed.
Select a field and click the drop-down arrow to display a list of controls that are available for the data type.
Click the type of control that you want to bind to.
Drag the field onto a form. The control will be added to the form together with a BindingSource component and a BindingNavigator component.
Repeat steps 4 though 6 for any other fields that you want to bind.
To bind a control to composite type returned by a WCF service
On the Data menu, select Show Data Sources. The Data Sources window will appear.
In the Data Sources window, expand the node for your service reference. Any composite types returned by the service will be displayed.
Select a node for a type and click the drop-down arrow to display a list of available options.
Click either DataGridView to display the data in a grid or Details to display the data in individual controls.
Drag the node onto the form. The controls will be added to the form together with a BindingSource component and a BindingNavigator component.
See Also
Tasks
How to: Add a Reference to a Web Service
Consuming ASMX and WCF Services Sample
How to: Bind Data to the Windows Forms DataGridView Control Using the Designer
Reference
Add Service Reference Dialog Box
Other Resources
Windows Communication Foundation Services and ADO.NET Data Services