As you will see as you learn more about Windows Forms, working with data is one of the most common tasks for any Windows Forms developer. This section walks you through the controls in the Toolbox that are in the "Data" category including what they do and how you use them. You'll see a lot more of these controls in Chapter 37, "Data Binding with Windows Forms 2.0."
The DataSet Control
When you drag a DataSet from the Toolbox onto a form, you are prompted for whether you want the DataSet to be based on a typed DataSet or a standard DataSet with no schema. If you select Typed DataSet, you can pick one from the current project or from any referenced assembly. After you select the type of DataSet you want, a new component will appear at the bottom of the designer that can then be used in conjunction with other data controls as an instance of a DataSet or typed DataSet.
The DataGridView Control
As you will see in Chapter 37, the DataGridView is an extremely powerful replacement for the old DataGrid control that came with previous versions of Windows Forms. This new grid is far easier to customize and control and has a lot of powerful new features, including a "virtual" mode that allows for extremely memory-efficient grids that can contain large numbers of records.
The BindingSource Control
The BindingSource control is a kind of "middle man" for data binding. When you have any type of data that can be bound, you can drag a BindingSource onto the form and select that BindingSource control's DataSource property. The BindingSource control can then be used as the target for any other control's DataSource property, and all BindingSource instances show up in the browse boxes for locating sources of data in the designer.
The BindingNavigator Control
The BindingNavigator control is a customized ToolStrip that contains buttons and actions appropriate to navigating through a list of data-bound items. It comes with buttons for navigating to the first, last, next, and previous records, as well as buttons for creating new records and deleting the current record. You can respond to events from this control for further customization and you can even add your own additional buttons to the navigator's ToolStrip.
The ReportViewer Control
The ReportViewer control should not be underestimated. A lot of people leave it out when discussing the new features in Windows Forms 2.0, but it's one of the controls used most often in the author's Windows Forms applications in commercial applications. This control has a ServerReport property that allows the developer to point to the location of a report hosted on the web such as a SQL 2005 Reporting Services report, and it has a LocalReport property that allows it to run a report using a .rdlc file that was designed within Visual Studio 2005. Directly in Visual Studio 2005, you can create a report, configure data sources within that report, and then bind the data sources in the report to live runtime data sources programmatically or even at design time. The power of this single control is incredible.