Hi.
I have a bounded datagridview and it's work fine.
I want to know if I can to add a combobox column to datagridview.

Thanks for all.

Recommended Answers

Sure you can. Simply create new DGVcomboBox column and add or insert it to dgv columns.

DataGridViewComboBoxColumn cmbcolumn = new DataGridViewComboBoxColumn(); 
{
    cmbcolumn.Name = "cmbColumn";
    cmbcolumn.HeaderText = "combobox column"; 
    cmbcolumn.Items.AddRange(new string[] { "aa", "ac", "aacc" }); //items in comboBox
}
dataGridView1.Columns.Insert(1, cmbcolumn); //inserting comboBox into 2nd columns …
Jump to Post

All 2 Replies

Sure you can. Simply create new DGVcomboBox column and add or insert it to dgv columns.

DataGridViewComboBoxColumn cmbcolumn = new DataGridViewComboBoxColumn(); 
{
    cmbcolumn.Name = "cmbColumn";
    cmbcolumn.HeaderText = "combobox column"; 
    cmbcolumn.Items.AddRange(new string[] { "aa", "ac", "aacc" }); //items in comboBox
}
dataGridView1.Columns.Insert(1, cmbcolumn); //inserting comboBox into 2nd columns (colimn at index 1)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.