VB.net ComboBox 在输入时自动下拉 [英] VB.net ComboBox auto drop down on input

查看:27
本文介绍了VB.net ComboBox 在输入时自动下拉的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个 ComboBox,它会根据输入自动删除包含该字母的单词.我的下拉样式是下拉,所以组合框有一个输入字段.

I want to create a ComboBox that automaitcally drops down the words containing the letter based on the input. My dropdownstyle is dropdown so the combobox has an input field.

例如,我会输入字母 A 或 a 我希望 ComboBox 自动下拉包含字母 A 或 a 的单词.ComboBox 的内容是我自己手动设置的.

For example i would input the letter A or a I want the ComboBox to automatically dropdown the words which contains the letter A or a. The contents of the ComboBox are being set by myself manually.

这可能吗?提前致谢.

推荐答案

你必须设置这些

AutoCompleteMode: SuggestAppend
AutoCompleteSource: ListItems
DropDownStyle: DropDown

假设您的组合包含这些项目,那么您还必须将它们添加到 autocompletecustomsource 中

Suppose your combo has these items then you have to add them to the autocompletecustomsource also

ComboBox1.Items.Add("10")
ComboBox1.Items.Add("92")
ComboBox1.Items.Add("9000")
ComboBox1.Items.Add("9001")

ComboBox1.AutoCompleteCustomSource.Add("10")
ComboBox1.AutoCompleteCustomSource.Add("92")
ComboBox1.AutoCompleteCustomSource.Add("9000")
ComboBox1.AutoCompleteCustomSource.Add("9001")

ComboBox1.AutoCompleteSource = AutoCompleteSource.CustomSource

这篇关于VB.net ComboBox 在输入时自动下拉的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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