Represents a column in a DataGridView control.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Unlike a DataGridViewRow, which contains the actual collection of cells in a DataGridView, is used mainly to adjust the appearance and behavior of the column user interface (UI), such as column width and cell style. For more information about cell styles, see Cell Styles in the Windows Forms DataGridView Control.
Types that derive from typically initialize the CellTemplate property to a new instance of a related type derived from the DataGridViewCell class. Any column properties that relate to the appearance or behavior of individual cells are wrappers for the corresponding properties of the template cell. Changing one of these properties on the column automatically changes the value on the cell template and on all cells in the column. To override the specified value for individual cells, set the cell values after you set the column value.Notes to Inheritors:
When you derive from and add new properties to the derived class, be sure to override the Clone method to copy the new properties during cloning operations. You should also call the base class's Clone method so that the properties of the base class are copied to the new cell.
The following code example creates a Windows Form with a DataGridView and a set of buttons. Each button label describes an operation related to a property, such as swapping the first and last column (using the DisplayIndex property) or changing the text of a column header (using the HeaderText property). Clicking a button changes the associated property of the .
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.