首先你得保证
DropDownStyle为DropDown,千万不要是DropDownList,这样会无法输入的。
然后确认接入了数据源,
接入了数据源是指:
using (var Context = new MyDbContext())
{
var GenreData = Context.Genres.OrderByDescending(x=>x.Id);
foreach(var item in GenreData)
{
comboBox1.Items.Add(item.Name);
}
comboBox1.SelectedIndex = 0;
}
最起码这样的。
在窗体初始化的构造方法里面写:
this.comboBox1.AutoCompleteSource = AutoCompleteSource.ListItems; //设置自动完成的源
this.comboBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend; //设置自动完成的的形式
参考文档:
https://www.cnblogs.com/huangfr/archive/2011/09/07/2170387.html
Today's comments have reached the limit. If you want to comment, please wait until tomorrow (UTC-Time).
There is 20h09m27s left until you can comment.