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 Formscontrol. 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, seeand .
The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see.
To change the type of a column using the designer
Choose Edit Columns from the control's smart tag.
Select a column from the Selected Columns list.
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.