Technical Training
VB.NET 2005.NET Complex Data Binding Page - 2
.NET Complex Data Binding
.
.
.
One-Way and Two-Way Data Binding
All that we have done, so far, is to ensure that the data in a database is retrieved and displayed to us using any of the Forms Controls. It is clear that some controls can take user input while others are prevented from taking user input. It is also evident that some controls provide dynamic views while others display only static views based on a snapshot of data.
This brings us to the next concept that needs to be understood. Binding allows data update depending on the type of control used. Bindings that do not allow the user to update the database that provided the user with the data are called One-Way Binding and the type of binding that allows the user to update the underlying database are called Two-Way Binding.
Two way bindings are available in all cases where the data source can be updated and the control has the capacity to display updated data. The user, however, has the option to prevent this by editing the properties of the control.
Closely allied to the concept of two way binding is the concept of System.DataSet. This concept was introduced in Visual Basic.NET to present a XML schema that is aware of the rowstate property. The rowstate property gets or sets the value of the rows so as to track changes to the row.
The System.Data.Common.DataAdapter’s Update method examines the System.Data.DataRow.RowState property, and executes the required INSERT, UPDATE, or DELETE statements iteratively for each row, based on the order of the indexes configured in the System.Data.DataSet. For example, System.Data.Common.DataAdapter.Update might execute a DELETE statement, followed by an INSERT statement, and then another DELETE statement, due to the ordering of the rows in the System.Data.DataTable. Let us see the code fragment for this
It should be noted that these statements are not executed as a batch process; each row is updated individually. This could raise some exceptions which the users will have to handle separately.
The BindingContext and CurrencyManager Classes
Binding controls on a form to the ADO.NET DataSet and providing navigation services that keep all controls in sync is accomplished through the use of two objects known as the CurrencyManager and the BindingContext. For each data-bound form that the user creates in the application, the user will have at least one BindingContext object. This object will be responsible for any CurrencyManager objects. The user will have one CurrencyManager object for each data source on the user’s form. The CurrencyManager object is responsible for keeping track of the user’s position in the DataSet and for the overall supervision of the bindings to the data source. The user will call the necessary methods on the CurrencyManager object to navigate through the records, and the BindingContext ensures that all bound controls are kept in sync. The DataNavigator control used in this application provides that functionality in an easier-to-use form.
The use of binding context can be illustrated by the following example where three text boxes are bound to three columns of the same table. While navigating, the synchronization of the three columns is made possible by BindingContext.

VB.NET 2005
- VB.NET 2005 Free Training
- The .NET Framework Architecture Part 1
- The .NET Framework Architecture Part 2
- Application Class and Message Class
- Implementing Class Library Object
- Visual Studio.NET Namespaces
- .NET Assemblies
- Differences between VB.NET 1.0 and VB.NET 2.0
- Introducing VB.NET Windows Forms
- Visual Studio Windows Forms Designer
- Exploring the Forms Designer generated code
- Setting and Adding Properties to Windows Form
- Implementing Inheritance
- Event Handling In Visual Basic .NET
- Building Graphical Interface elements
- .NET Common Windows Forms Controls Part 1
- .NET Common Windows Forms Controls Part 2
- Common Controls and Handling Control Events
- DomainUpDown and NumericUpDown Controls
- Dialog Boxes in Visual Basic .NET
- Visual Studio Adding Controls to Windows Form
- VB.NET Validation Controls
- Working with Menu Controls
- VB.NET MDI Applications
- .NET Exceptions
- VB.NET Creating and Managing Components Part 1
- VB.NET Creating and Managing Components Part 2
- Simple Data Binding
- .NET Complex Data Binding
- .NET Data Form Wizard
- Data Manipulation with ADO.NET
- SQL Server Stored Procedures
- SQL Server Ad Hoc Queries
- Finding and Sorting Data in DataSets
- ADO.NET Object Model
- Working with DataSets
- Using XML Data
- Working with File System in .NET
- Creating Web Service
- Instantiating - Invoking Web Services, Creating Proxy Classes with WSDL
- Web Reference and Web Services
- Web Services - SOAP, WSDL, Disco and UDDI
- Web Application Testing in VB.NET 2005
- Web Application Tracing and Debugging
- Working with Legacy Code and COM Components
- ActiveX Controls and Legacy Code
- Windows Application Testing
- VB.NET Windows Application Testing
- Tracing VB.NET Windows Application
- Debugging Windows Applications In Visual Studio.NET 2005
- Deploying Windows Applications In Visual Studio.NET 2005
- Customizing Setup Project in Visual Studio.NET 2005
- Shared Assembly
- Microsoft .NET Creating Installation Components
- The Registry Editor in Visual Studio.NET 2005
- The File Types Editor







