Вопрос

I have a Datagridview in Winform. One of the column is a Combobox. Is it possible to set the property such that user can enter apart from being able to select the entries from the dropdown list.

I was able to do it on a Combobox item with a following changes from the properties window:

AutoCompleteMode.SuggestAppend;
AutoCompleteSource.CustomSource;
DropDownStyle : Dropdown;

Thanks

Это было полезно?

Решение

Something like this may Help :-

private void DataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
{
    if (DataGridView1.CurrentCell.ColumnIndex == yourComboBoxColum)
    {
        ComboBox combo = e.Control as ComboBox;

        if (combo == null)
            return;

        combo.DropDownStyle = ComboBoxStyle.DropDown;
    }
}
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top