O'Reilly logo

A Programmer's Guide to .NET by Alexei Fedorov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

13.2. Working with data in Windows forms applications

When creating Windows forms applications, we can take advantage of the data binding capabilities of nearly all Windows controls. Here is a list of controls that are often bound to data sources:

  • TextBox;

  • ComboBox;

  • ListBox;

  • CheckedListBox;

  • ErrorProvider.

Each control supports the DataBindings property (of a Binding type), which allows us to specify the source of the data and the data member to bind to the control. For example, to bind the TextBox control to the CustID field from the Customers table, accessible via the DataSet, we use the following code:

Text2.DataBindings.Add(New Binding("Text", ds, "Customers.CustID")) 

Let’s take the following example (some of the code has been omitted for the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required