문제

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
도움이 되었습니까?

해결책 2

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

DataGridViewComboBoxColumn

or you can set it programmatically

다른 팁

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

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top