0

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
Tobia Zambon
  • 7,479
  • 3
  • 37
  • 69
McDermott
  • 1,025
  • 2
  • 16
  • 28

3 Answers3

2

You should set property AutoGenerateColumns to false and then create each column with respective template

Nogard
  • 1,779
  • 2
  • 18
  • 21
1

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

DataGridViewComboBoxColumn

or you can set it programmatically

Tobia Zambon
  • 7,479
  • 3
  • 37
  • 69
0

You need to design column in datagridview in designer ,Change the type to required column to DataGridViewcombox

And then add value of this column from desired DataTable column