Edit text in a DataGridViewComboBoxColumn
Hi all,
How can I edit a text in a DataGridViewComboBoxColumn?
BR / Chris
Hi all,
How can I edit a text in a DataGridViewComboBoxColumn?
BR / Chris
DataGridViewCellValidatingEventArgs e) { if (e.ColumnIndex == comboBoxColumn.DisplayIndex) { if (!this.comboBoxColumn.Items.Contains(e.FormattedValue)) { this.comboBoxColumn.Items.Add(e.FormattedValue); } } } private void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e) { if (this.dataGridView1.CurrentCellAddress.X == comboBoxColumn.DisplayIndex) { ComboBox cb = e.Control as ComboBox; if (cb != null) { cb.DropDownStyle = ComboBoxStyle.DropDown; } } }
private void dataGridView1_CellValidating(object sender,
Hi Zhi-Xin,
Thanks for your answer.
I’m working with a gridview in a databound scenario. The entered value will not be accepted this way.
BR / Chris
Christian Burgener wrote:
Hi Zhi-Xin,
Thanks for your answer.
I’m working with a gridview in a databound scenario. The entered value will not be accepted this way.
BR / Chris
"GridView"? Sounds like you're using ASP.NET, if so, I recommend you post this question at http://forums.asp.net for better responses.