如何链接TextBox';s实体框架的AutoCompleteSource
本文关键字:实体 框架 AutoCompleteSource 何链接 链接 TextBox | 更新日期: 2023-09-27 18:21:23
我有一个表"Clients"和一个名为tbClient的文本框,但我不知道如何在文本框上使用实体框架和LINQ实现自动完成。这就是我实际拥有的
var client = from a in ca.Clients select new { a.Name, a.DNI, a.Address, a.Phone, a.Email};
var cli = client.ToList();
dgvClient.DataSource = cli;
填充数据网格查看
i已解决
var name = from a in ca.Clients select a.Name;
AutoCompleteStringCollection sourcename = new AutoCompleteStringCollection();
sourcename.AddRange(name.ToArray());
this.tbName.AutoCompleteMode = AutoCompleteMode.Suggest;
this.tbName.AutoCompleteSource = AutoCompleteSource.CustomSource;
this.tbName.AutoCompleteCustomSource = sourcename;