C# 使组合框可编辑

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/805638/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-05 01:56:19  来源:igfitidea点击:

making a combo box editable

c#combobox

提问by

I want make the combo box editable in c# that should accept input from keyboard and from the drop-down and I want to append the text that is entered to the drop-down list.

我想让组合框在 c# 中可编辑,它应该接受来自键盘和下拉列表的输入,我想将输入的文本附加到下拉列表中。

回答by Nicholas

You need to:

你需要:

1) Set the AutoCompleteMode property to AutoCompleteMode.SuggestAppend

1) 将 AutoCompleteMode 属性设置为 AutoCompleteMode.SuggestAppend

2) Set the AutoCompleteSource property to AutoCompleteSource.CustomSource

2) 将 AutoCompleteSource 属性设置为 AutoCompleteSource.CustomSource

3) Set the AutoCompleteCustomSource property to an AutoCompleteStringCollection of your possible matches.

3) 将 AutoCompleteCustomSource 属性设置为可能匹配的 AutoCompleteStringCollection。