» Home
» Tutorials
» Search  
» Contact us 

Home » Tutorials » Introduction to Visual Basic .NET » Chapter 10

Chapter 10: Working with Databases
10.5: Data Binding
10.5.1: Binding Data to a DataGridView Control
10.5.1.1: How It Works

How It Works

The approach you took to creating a data-bound application in this exercise is the most straightforward approach and the easiest. You started by adding a DataGridView control to your form, which caused you to be prompted with the Tasks dialog box for the DataGridView.

This dialog box allowed you to create a new Data Source via the Data Source Configuration Wizard, which walked you through a series of steps, the first of which was to identify the type of data source that you wanted to use. You were then allowed to specify the type of database object that you wanted to use to retrieve your data, and in this step you merely chose to use a specific table in your database and selected specific columns from that table.

Once you clicked the Finish button in the Data Source Configuration Wizard, several components were automatically generated and added to your project. These included the TableAdapter, DataSet, and BindingSource. The BindingSource was the actual component that was bound to the DataSource property of the DataGridView control.

Remember that the BindingSource’s job is to communicate the data needs of the control to the data source, which in this case is the DataSet containing all of the data. The DataSet was populated with data by the TableAdapter when your form was loaded.

The most important point of this exercise was the ease with which you were able to create a data-bound application and the simple fact that you did not have to write a single line of code to achieve the end results.

 

click next Page - Binding Data to TextBox Controls.

Home | Link to Us | Partner Links | About us | Contact us

Copyright © 2009-2012 F1tutorials.com | All Rights Reserved