DataGridView Control Overview (Windows Forms)

System_CAPS_ICON_note.jpg Note

The DataGridView control replaces and adds functionality to the DataGrid control; however, the DataGrid control is retained for both backward compatibility and future use, if you choose. For more information, see Differences Between the Windows Forms DataGridView and DataGrid Controls.

With the DataGridView control, you can display and edit tabular data from many different kinds of data sources.

Binding data to the DataGridView control is straightforward and intuitive, and in many cases it is as simple as setting the DataSource property. When you bind to a data source that contains multiple lists or tables, set the DataMember property to a string that specifies the list or table to bind to.

The DataGridView control supports the standard Windows Forms data binding model, so it will bind to instances of classes described in the following list:

The DataGridView control supports data binding to the public properties of the objects returned by these interfaces or to the properties collection returned by an ICustomTypeDescriptor interface, if implemented on the returned objects.

Typically, you will bind to a BindingSource component and bind the BindingSource component to another data source or populate it with business objects. The BindingSource component is the preferred data source because it can bind to a wide variety of data sources and can resolve many data binding issues automatically. For more information, see BindingSource Component.

The DataGridView control can also be used in unbound mode, with no underlying data store. For a code example that uses an unbound DataGridView control, see Walkthrough: Creating an Unbound Windows Forms DataGridView Control.

The DataGridView control is highly configurable and extensible, and it provides many properties, methods, and events to customize its appearance and behavior. When you want your Windows Forms application to display tabular data, consider using the DataGridView control before others (for example, DataGrid). If you are displaying a small grid of read-only values, or if you are enabling a user to edit a table with millions of records, the DataGridView control will provide you with a readily programmable, memory-efficient solution.

DataGridView Control Technology Summary
Summarizes DataGridView control concepts and the use of related classes.

DataGridView Control Architecture
Describes the architecture of the DataGridView control, explaining its type hierarchy and inheritance structure.

DataGridView Control Scenarios
Describes the most common scenarios in which DataGridView controls are used.

DataGridView Control Code Directory
Provides links to code examples in the documentation for various DataGridView tasks. These examples are categorized by task type.

Column Types in the Windows Forms DataGridView Control
Discusses the column types in the Windows Forms DataGridView control used to display information and allow users to modify or add information.

Displaying Data in the Windows Forms DataGridView Control
Provides topics that describe how to populate the control with data either manually, or from an external data source.

Customizing the Windows Forms DataGridView Control
Provides topics that describe custom painting DataGridView cells and rows, and creating derived cell, column, and row types.

Performance Tuning in the Windows Forms DataGridView Control
Provides topics that describe how to use the control efficiently to avoid performance problems when working with large amounts of data.

DataGridView Control
Default Functionality in the Windows Forms DataGridView Control
Default Keyboard and Mouse Handling in the Windows Forms DataGridView Control