Binding Data to a Control

Up to now all of the examples that have painted the contents of a DataSet have done so by iterating through the DataTables.Rows collection for each DataTable inside the DataSet. This is non-ideal for several reasons:

  • The burden of responsibility to paint the data manually every time there is an update in the DataSet contents falls on the developer.

  • The process of painting into a ListBox is error prone.

  • It is unwieldy to write code that paints only those DataRows with certain RowState values.

  • It is not easy to make the ListBox appealing to the eye when using it to display relational data.

The best solution to this problem is to use data binding, which connects a source of data to a consumer. The most popular source of data ...

Get Microsoft® .NET Compact Framework Kick Start 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.