ComboBox实现自动搜索功能
怎么样实现在Winform的ComboBox控件中实现自动搜索数据的功能!!! --------------------编程问答-------------------- AutoCompleteMode 选为Suggest,Append或SuggestAppendAutpCompleteSource再设置下,就可以了 --------------------编程问答-------------------- 不太理解你的意思,但是,有两个属性
AutoCompleteSource、AutoCompleteMode
大概是和你的需求有关。 --------------------编程问答-------------------- private DataTable GetData(string strSQl)
{
DataTable dtData = new DataTable();
using (SqlConnection thisConnection = new SqlConnection(
@"Data Source=.;Initial Catalog=NorthWind;Integrated Security=True"))
{
using (SqlDataAdapter thisAdapter = new SqlDataAdapter(
strSQl, thisConnection))
{
thisAdapter.Fill(dtData);
}
thisConnection.Close();
}
return dtData;
}
BindingSource bind = new BindingSource();
string str1 = "select * from Employees";
private void Form1_Load(object sender, EventArgs e)
{
comboBox1.DisplayMember = "LastName";
comboBox1.DataSource = GetData(str1);
comboBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
comboBox1.AutoCompleteSource = AutoCompleteSource.ListItems;
} --------------------编程问答-------------------- 我也正需要这个呢,谢谢!!! --------------------编程问答-------------------- 有学了一招,不错 :) --------------------编程问答-------------------- 3L 正解
补充:.NET技术 , C#