110,534
社区成员
发帖
与我相关
我的任务
分享
//绑定原始数据源
private void BindComboBox()
{
string str = "select License from tb_drug";
SQLiteDataReader sdr = sh.getcom(str);
while (sdr.Read())
{
if (sdr[0].ToString() != " " && sdr[0].ToString() != null)
listOnit.Add(sdr[0].ToString());
}
sdr.Close();
this.comboBox1.Items.AddRange(listOnit.ToArray());
}
private void comboBox1_TextUpdate(object sender, EventArgs e)
{
this.comboBox1.Items.Clear();
listNew.Clear();
foreach (string item in listOnit)
{
if (item.Contains(this.comboBox1.Text))
{
listNew.Add(item);
}
}
this.comboBox1.Items.AddRange(listNew.ToArray());
this.comboBox1.SelectionStart = this.comboBox1.Text.Length;
Cursor = Cursors.Default;
this.comboBox1.DroppedDown = true;
}