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 ...
Get A Programmer's Guide to .NET 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.