6.10. The DataGrid Control

The DataGrid control supports the display, entry, and selection of data in table format, with row and column access. This section shows a simple use of DataGrid to display database and XML data. In Figure 6.15, for example, a data grid is used to display the Access database food description table we worked with in Section 5.10.

Figure 6.15. The Default DataGrid View of an Access Database File

DataGrid is a drag-and-drop control of the Windows Forms designer. We simply drop the grid on the form, then position and size it. Our work involves getting the data into the grid. Typically, this is a two-step process:

1.
We retrieve ...

Get C# Primer: A Practical Approach 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.