在ComboBox中过滤

时间:2013-07-17 18:17:35

标签: c# winforms combobox

我使用以下数据填充组合框的数据库值:

    public void fillcombo()
    {
        using (SqlConnection myDatabaseConnection = new SqlConnection(myConnectionString.ConnectionString))
        {
            myDatabaseConnection.Open();
            using (SqlCommand mySqlCommand = new SqlCommand("Select Description from LibraryCongressClassificationOutline", myDatabaseConnection))
            using (SqlDataReader sqlreader = mySqlCommand.ExecuteReader())
            {

                while (sqlreader.Read())
                {
                    string Desc = sqlreader.GetString(sqlreader.GetOrdinal("Description"));
                    comboBox1.Items.Add(Desc);
                }
            }
        }
    }

当我输入comboBox时我将如何过滤数据并自动显示comboxSelection中的所有数据(不知道它叫什么)而不点击这个enter image description here

enter image description here

1 个答案:

答案 0 :(得分:0)