Where Are We

This chapter has covered all the main features of the DataGridView control. It focused a lot on the code involved and what the capabilities were. For most common cases, you'll be able to get what you need simply by defining the columns in the designer, setting up some data binding with the Data Sources window, and maybe mixing in some custom code and event handlers. The DataGridView control is considerably simpler to use and more flexible and powerful than the DataGrid control from .NET 1.0, and you should always favor using the DataGridView for new applications that will present tabular data or something that needs to be presented in a grid format.

Some key takeaways from this chapter are:

® Setting the DataSource and DataMember properties on the DataGridView to a BindingSource that binds to the data source is the standard way of using the grid.

® Use the Edit Columns functionality in the designer Smart Tag for the easiest way to edit and customize the bound and unbound column types and properties.

® Bound columns will use automatic type conversion and formatting similar to theBinding object, as discussed inChapter 4.

® To add a custom cell type, you create a custom column type derived from DataGridViewColumn, and a custom cell type derived from DataGridViewCell or one of the derived built-in cell types.

Next we'll go deeper into the data-binding mechanisms used in Windows Forms, specifically the interfaces that you need to understand and implement in order to create any custom data objects or collections that you want to use for data binding. You will gain a better understanding of what the data-bound controls are looking for when you set up data binding, and how they use what they find.

4 PREY

NEXT +<

0 0

Post a comment