How to: Change the Type of a Windows Forms DataGridView Column Using the Designer

Sometimes you will want to change the type of a column that has already been added to a Windows Forms DataGridView control. For example, you may want to modify the types of some of the columns that are generated automatically when you bind the control to a data source. This is useful when the table you display has columns containing foreign keys to rows in a related table. In this case, you may want to replace the text box columns that display these foreign keys with combo box columns that display more meaningful values from the related table.

The following procedure requires a Windows Application project with a form containing a DataGridView control. For information about setting up such a project, see How to: Create a Windows Forms application project and How to: Add Controls to Windows Forms.

To change the type of a column using the designer

  1. Click the designer actions glyph (Small black arrow) on the upper-right corner of the DataGridView control, and then select Edit Columns.

  2. Select a column from the Selected Columns list.

  3. In the Column Properties grid, set the ColumnType property to the new column type.


    The ColumnType property is a design-time-only property that indicates the class representing the column type. It is not an actual property defined in a column class.

See also