通过键入在组合框中选择一个项目 [英] Selecting an item in comboBox by typing

查看:18
本文介绍了通过键入在组合框中选择一个项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含数百个项目的组合框.用户必须能够在组合框中键入文本.在用户键入文本时,必须选择或列出以键入的值开头的项目.用户必须能够连续打字.我的 ComboBox DropDownStyle 是 DropDownList

I've a combobox that has hundreds item in it. User must be able to type the text into the combobox . While the user is typing the text, the item that starting with the typed value must be selected or listed. The user must be able type continuously. My ComboBox DropDownStyle is DropDownList

例如:通过键入在组合框中选择名称时,它只允许一个字母.所以如果我输入A",它会跳到以A"开头的第一个字母.当我连续输入时,组合框选定的项目会根据当前的按键变化.如果我按As",组合框会查看以s"开头的项目.

Eg: While selecting a name in comboBox by typing, it only allows one letter. So if I type "A" it will jump to the first letter starting with "A". when i type continuously the combo box selected item changes according to the current keypress. if i press "As", combobox viewing the items starting with "s".

我使用的是 Win Forms.

I'm using Win Forms.

提前致谢..

推荐答案

comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDown;
comboBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
comboBox1.AutoCompleteSource = AutoCompleteSource.ListItems;

这篇关于通过键入在组合框中选择一个项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆