autosuggest不工作​​(在运行时我添加了数据但不建议) [英] autosuggest not working (in runtime i added data but its not suggesting)

查看:88
本文介绍了autosuggest不工作​​(在运行时我添加了数据但不建议)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

private void purchase_Load(object sender, EventArgs e)
       {
           UGIcon = new SqlConnection(@"Data Source=SELVA-T;Initial Catalog=textile;Integrated Security=True;MultipleActiveResultSets=True;");

           UGIcon.Open();
           cmd = new SqlCommand("SELECT * from purchase", UGIcon);
           SqlDataReader re = cmd.ExecuteReader();
           AutoCompleteStringCollection coll = new AutoCompleteStringCollection();
           while (re.Read())
           {
               coll.Add(re.GetString(1));
           }
           toolStripTextBox1.AutoCompleteCustomSource = coll;
           re.Close();
           UGIcon.Close();
       }



c

这是我在toolstriptextbox编码中的autosuggest单词



如果我在数据库中插入单词Love并在toolstriptextbox中输入字母L,它不显示当前插入的单词...如果我关闭应用程序并再次运行然后只有它显示单词Love如果我输入L...



在运行时如果我向DB添加一个单词,它需要在auto中显示建议清单......

我需要做什么..?


c
This is my autosuggest words in toolstriptextbox coding

if i insert the word "Love" into the DB and enter a letter "L" in toolstriptextbox its not displaying currently inserted word... if i close the application and run again then only its displaying the word "Love" if i type "L"...

In runtime if i add a word to DB it need to be displayed in auto suggestion list...
what i need to do..?

推荐答案





以下链接可能对您有用



http://msdn.microsoft.com/en-us/library/ms404304.aspx [ ^ ]

http: //msdn.microsoft.com/en-us/library/system.windows.forms.toolstriptextbox.autocompletecustomsource.aspx [ ^ ]


嗨试试这个



Hi Try this

AutoCompleteStringCollection AutoItem = new AutoCompleteStringCollection();
            foreach (DataRow OSAmt in dataSetStockistOutstanding1.OutstandingAmount1)
            {
                AutoItem.Add(OSAmt["CustCode"].ToString());
                AutoItem.Add(OSAmt["CustCompName"].ToString());
                AutoItem.Add(OSAmt["ChequeNo"].ToString());
                AutoItem.Add(OSAmt["InvoiceNo"].ToString());
            }
            Tesearchupdate.AutoCompleteMode = AutoCompleteMode.Suggest;
            Tesearchupdate.AutoCompleteSource = AutoCompleteSource.CustomSource;
            Tesearchupdate.AutoCompleteCustomSource = AutoItem;


这篇关于autosuggest不工作​​(在运行时我添加了数据但不建议)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆