0

我用数据库值填充组合框:

    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中自动显示所有数据(不知道它叫什么)而不点击它在此处输入图像描述

在此处输入图像描述

4

1 回答 1

0

您需要使用 AutoComplete:http: //msdn.microsoft.com/en-us/library/system.windows.forms.combobox.autocompletemode.aspx

于 2013-07-17T18:19:31.463 回答