ADO.NET Programming in Visual Basic .NET (2nd Edition)
Team-Fly |
| ADO.NET Programming in Visual Basic .NET By Steve Holzner, Bob Howell
|
Table of Contents | |
Data binding is the ability of a set of controls to automatically display data from an underlying DataSource with little or no code provided by the programmer. Data binding is normally connected with visual controls, but it does not have to be. It is possible to bind data to properties of nonvisual components as well. Data binding was introduced by Microsoft in Visual Basic 3.0. Prior to this there were Visual Basic custom controls (VBXs) that could be used to accomplish the same result. When data binding was introduced, it was considered revolutionary. Programmers could now create a fully active data-bound form without writing any code at all. This was an integral part of the rapid application development (RAD) programming methodology. However, many programmers shunned the use of data binding because you also sacrificed a lot of control when you used it. As each new version of Visual Basic was released, more control was given to the programmer using data binding, until now it can be used without sacrificing any control at all. As a matter of fact, now it is actually more desirable to use data binding than not. It simply no longer pays to not use it. Not convinced? Hopefully, by the end of this chapter you will be. When we talk about data binding in Visual Basic, we are really talking about data binding in the .NET Framework. The framework offers two binding models, one for Windows Forms, and one for Web Forms. The Windows Forms data binding model is two-way. That is, it supports both displaying data in controls and automatically updating the data in the underlying DataSource when the user changes the data in the controls. The Web Forms model is display-only. This has nothing to do with some arbitrary decision made by Microsoft. It is because web-based forms are stateless, and once the page containing the form is served to the client, there is no software behind it to respond to changes and notifications. We will look at both binding methods . Though similar, there are significant differences between them beyond just the display-only issue. In this chapter we will be dealing with Windows Forms. In the next chapter we will look at Web Forms. |
Team-Fly |
Top |