开发者

Remember values that user has typed into a combobox

Is there any built-in or easy way to add autocomplete and persistence to a combobox (like in a browser)?

It would also be great if users could delete entries (also present in most browsers)?

Basically, the user would type in a command, then type in another one and also be able to use the dropdown (or Suggest/SuggestAppend) to grab any previous c开发者_如何转开发ommands.


I don't think there is a control to do everything you want, but the built-in TextBox control in WinForms does support auto-complete.

TextBox textBox = new TextBox();
textBox.AutoCompleteCustomSource.AddRange(new string[]
{
    "Value1",
    "Value2",
    "Value3",
    // etc..
});
textBox.AutoCompleteMode = AutoCompleteMode.Suggest;
textBox.AutoCompleteSource = AutoCompleteSource.CustomSource;

Find some more info on MSDN. You may be able to find 3rd party controls that have more complete functionality.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜