Chapter 12. Data Binding with Windows Forms Controls

 < Day Day Up > 

Topics in This Chapter

  • DataBinding Overview: Associating data with a control is easy on the surface; however, it is important to understand what's going on underneath. This section provides an overview of simple and complex data binding, one-way and two-way data binding, and the role of the Binding and BindingManagerBase classes.

  • A Data Binding Application: A Windows Forms application illustrates how to bind data in a DataSet and DataTable to simple and complex controls.

  • The DataGridView: The DataGridView introduced with .NET 2.0 has a rich set of features that enable it to display and manipulate relational data. Examples illustrate how to create a master-detail grid and a virtual mode grid.

Chapter 11, "ADO.NET." discussed how to access data using ADO.NET. This chapter extends the discussion to describe the techniques by which data is "bound" to the Windows Forms controls that display data. Because all controls derive their data binding capabilities from the base Control class, knowledge of its properties and methods can be applied to all controls. Although many of the same concepts apply to Web controls, data binding for them is discussed separately in Chapter 16, "ASP.NET Web Forms and Controls."

Data binding comes in two flavors: simple and complex. Controls that contain one value, such as a label or Textbox, rely on simple binding. Controls populated with rows of data, such as a ListBox, DataGrid, or DataGridView, require complex binding. We'll look at how both are implemented.

Of the Windows Forms controls that bind to data, the DataGridView is the most complex and useful. Its layout maps directly to the rows and columns of a relational database or similarly structured XML document. This chapter takes a detailed look at the properties and methods of this control, and provides examples of how this control can be used to implement common database applications.

     < Day Day Up > 

    Core C# and  .NET
    Core C# and .NET
    ISBN: 131472275
    EAN: N/A
    Year: 2005
    Pages: 219 © 2008-2017.
    If you may any questions please contact us: