让自己的Textbox能自动完成及字词联想

        private void MaintainForm_Load(object sender, EventArgs e)
        {
            string[] array = new string[] { "hello", "hi", "nihao", "hehe", "yes", "no", "nobody", "morning", "yellow", "moon" };
            AutoCompleteStringCollection AutoCollection = new AutoCompleteStringCollection();
            AutoCollection.AddRange(array);
            textBox1.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
            textBox1.AutoCompleteSource = AutoCompleteSource.CustomSource;
            textBox1.AutoCompleteCustomSource = AutoCollection;
        }

 

posted @ 2018-11-13 20:43  情怀丶感伤  阅读(156)  评论(0编辑  收藏  举报