Search code examples
c#winformsdatagridviewdatagridviewcolumn

How to set colums to be comboboxes


I have populated a DataGridView from a dataTable. I wan't some columns to appear as comboboxes, dropdowns. How do I do this? My code sofar:

DataTable dt = dataBase.getData();
this.dataGridView1.DataSource = dt;
//set some columns to comboboxes

Solution

  • In the designer you can set that a column is of type:

    DataGridViewComboBoxColumn
    

    or you can set it programmatically