BindingSource in Visual Basic .NET

Tags: VB.NET, VB 2008, VB 2010, VB 2012, VB 2013

This lesson describes the BindingSource control

Binding Source

The BindingSource object encapsulates all of the DataSet object's data and provides programmatic control functions that perform actions such as moving through the data, adding, updating, deleting items etc.
In other words the BindingSource provides control of bound data on a form.

To display data Visual Basic .NET usually uses DataSet, TableAdapter, BindingSource, and BindingNavigator objects.

Binding Source

binding source figure

As figure shows the BindingNavigator is the only one of these components present on the form.
It is controling the BindingSource but does not actually transfer data back and forth.
Rather it does the BindingSource object. Meaning, any interaction with the data from your controls goes through the BindingSource, which in turn communicates with your data source.

For example, say that your DataGridView is initially filled with some data. When you request sorting of a column, the DataGridView control will communicate that intention to the BindingSource, which in turn communicates that intention to the data source.

Typically you attach the BindingSource to a data source and then you bind controls to the BindingSource.
When the BindingSource changes its position in the data source, it automatically updates the bound controls.

Note: if you want to manipulate the database directly with code, you could avoid BindingSource as well as the other mentioned objects.

Previous Lesson | Next Lesson

Share This

Home | About | Contact | Privacy Policy

Copyright 2018 - All Rights Reserved.