Binding Controls with Code

The examples presented in this chapter use connections, data adapters, DataSets, and DataViews defined at design time to interact with the database. There’s nothing magic about creating these objects at design time, however. All the Visual Basic development environment does is insert code in a region named “Windows Form Designer Generated Code” at the beginning of your program. If you look near the top of your source file, you can find this section. Click on the plus sign to its left to expand the region and look at the code. If you look closely, you will find all these objects defined and initialized in that section.

Instead of creating all these objects at design time, you can write code to create them at runtime. ...

Get Visual Basic® .NET Database Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.