我每输入一个字都可以从数据库中将类似的字符串查询出来,并像百度的那样下拉显示出来
实现过的朋友指点一下

解决方案 »

  1.   

    winfrom textbox输入智能提示核心代码://下面3行用设置智能提示
                this.textBox1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
                this.textBox1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource;
                this.textBox1.AutoCompleteCustomSource = ac;//设置数据源其中     AutoCompleteStringCollection ac = new AutoCompleteStringCollection();本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/LCL_data/archive/2009/12/18/5032160.aspx
      

  2.   

    可以的,在Text.Text changed事件里执行查询
      

  3.   

          this.textBox1.AutoCompleteCustomSource.AddRange(new string[] {
                "aaaaaaa",
                "aabbbbb",
                "cccccc",
                "dddddd"});
          this.textBox1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
          this.textBox1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource;
      

  4.   

    还在吗?
    我想问一下
    照你说的去做了后又这个错误是怎么回事错误 1 无法将类型“System.Windows.Forms.AutoCompleteStringCollection”隐式转换为“System.Windows.Forms.AutoCompleteSource” D:\c#Projects\BeforeHandBuy\BeforeHandBuy\BuyMainForm.cs 26 51 BeforeHandBuy
      

  5.   


    AutoCompleteStringCollection acsc = new AutoCompleteStringCollection();
    acsc.Add("asdjhkj");
    acsc.Add("2412312");
    acsc.Add("asdaasdkj");
    acsc.Add("78fsdfhj");
    acsc.Add("0if0sdfn");
    acsc.Add("67dasgdh");
    acsc.Add("0dasdjasd");
    acsc.Add("23ashdb");
    this.textBox1.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
    this.textBox1.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource;
    this.textBox1.AutoCompleteCustomSource = acsc;
      

  6.   

    还是有问题啊 
    我在textbox的textchanged事件中将返回的dt添加到AutoCompleteStringCollection 对象中AutoCompleteStringCollection  = ac = new AutoCompleteStringCollection();
    for(int i = 0 ;i< dt.rows.count;i++)
    {
       ac.add(dt.rows[i][0].tostring());
    }
    其他完全一样!
    这样还是出错阿!