Tutorials
VB.NET 2005In this tutorial you will learn about Complex Data Binding, Binding to a ComboBox or ListBox, Binding to a DataGrid.
Complex data binding is the ability of a control to bind to more than one data element, typically more than one record in a database, or to more than one of any other type of bindable data elements. Examples of controls that support complex binding are the DataGridView, ListBox, and ErrorProvider controls.
In this section let us create a complex binding by using a ComboBox and a ListBox. As in the preceding section the user must add a database connection to the project and to generate DataSets. Then he must proceed to create a new Windows Application Project by name ComplexDataBindingDemo. After creating the Data Connection to the SQLServer Database, from the ToolBox, he must drag and drop a DataGrid control and a list box on the form Form1. At this point the user’s window should look like the following screenshot:

Here also the user will have to go through all the steps involved to set up the data providers and also bind them to the control. After doing this the user will have to set the value to the DataSource property of the controls to the data set. Now in some controls like ListBox and ComboBoxes the user will come across two properties viz, display member and value member. In a typical situation he will be needing the descriptive value of the column to be displayed while the use of the values like ProductId etc need to be passed as values to further queries. The user will have to set these values also.
The following screenshots will show the output for ComplexBinding using a combo box, list box and a DataGrid.

A DataGrid is a very useful Control. A number of improvements have been made to this control in .NET Framework 2005. Binding Data to DataGrid is simple. As a first step, The user has to set the value for the property Advanced Binding and DataSource.
1.2.3.4.5.
The following screenshot shows the final appearance of the DataGrid





Next Page: .NET Complex Data Binding - Page 2
| how to place data from datagridview from one form and acess the same row in other form textbox's.. |
| How to get total number of records in the datagrid view? |
| datagridview1.rowcount |