0
我想在组合框中添加一些功能。我希望它应该像谷歌的搜索框一样。就像我从数据库添加组合框中的项目说的医生名称。 我希望作为医生的用户类型名称或医生的姓名的第一个字母,选择栏自动只会转到相关的名称。动态选择组合框中的项目
任何建议朋友?
我想在组合框中添加一些功能。我希望它应该像谷歌的搜索框一样。就像我从数据库添加组合框中的项目说的医生名称。 我希望作为医生的用户类型名称或医生的姓名的第一个字母,选择栏自动只会转到相关的名称。动态选择组合框中的项目
任何建议朋友?
尝试组合框的AutoCompleteMode
,这样的事情:
сomboBox.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
сomboBox.AutoCompleteSource = AutoCompleteSource.CustomSource;
comboBox.AutoCompleteCustomSource = MyStringData();
其中myStringData是:
public AutoCompleteStringCollection MyStringData()
{
var collection= new AutoCompleteStringCollection();
//you can add names of the doctors retrieved from the database here
collection.Add("one");
collection.Add("two");
collection.Add("three");
collection.Add("four");
return collection;
}
这将表明它与您键入开始的项目。
如果你想显示选择(高亮)输入文字时,你可以多一点创意,并创建一个文本框和GridView,其获取绑定,每次TextChanged
发生在文本框的简单组合
的WinForms?或asp.net或mvc? –
Winforms @Manish Mishra – Flanker