Displays data in a customizable grid.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
The control provides a customizable table for displaying data. The class allows customization of cells, rows, columns, and borders through the use of properties such as DefaultCellStyle, ColumnHeadersDefaultCellStyle, CellBorderStyle, and GridColor. For more information, see Basic Formatting and Styling in the Windows Forms DataGridView Control.
You can use a control to display data with or without an underlying data source. Without specifying a data source, you can create columns and rows that contain data and add them directly to the using the Rows and Columns properties. You can also use the Rows collection to access DataGridViewRow objects and the DataGridViewRow::Cells property to read or write cell values directly. The Item indexer also provides direct access to cells.
As an alternative to populating the control manually, you can set the DataSource and DataMember properties to bind the to a data source and automatically populate it with data. For more information, see Displaying Data in the Windows Forms DataGridView Control.
When working with very large amounts of data, you can set the VirtualMode property to true to display a subset of the available data. Virtual mode requires the implementation of a data cache from which the control is populated. For more information, see Data Display Modes in the Windows Forms DataGridView Control.
For additional information about the features available in the control, see DataGridView Control (Windows Forms). The following table provides direct links to common tasks.
Although the control replaces and adds functionality to the DataGrid control of previous versions, 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.
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.