winform中combobox控件不会使用,希望各位指点!
我就是想实现类似CSDN论坛登陆框中输入用户名的那个效果,会记录下输入过的东西,然后下次输入类似字符的时候就会有相应的记录显示出来.
这个应该怎么做?

解决方案 »

  1.   

    保存在一個文檔裡咯`
    比如記事本,XML
    下次運行時再讀取
    我做過winform滴這樣功能
      

  2.   

    对,就是想用COMBOBOX做类似IE的这种功能,楼上的朋友的意思是把Combobox中的内容存在其它文档中,然后读取是吗?能不能提供些代码学习下?
      

  3.   

      private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
            {
                if (e.KeyChar == 13)
                {
                    if (textBox1.Text.ToString() != "")
                    {
                        this.listBox1.Items.Add(this.textBox1.Text);
                        this.textBox1.Text = "";
                    }
                }
            }        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
            {
                if (listBox1.SelectedItem.ToString() != "")
                {
                    textBox1.Text = listBox1.SelectedItem.ToString();
                    textBox1.SelectionStart = this.textBox1.Text.Length;
                    textBox1.Focus();
                    listBox1.Visible = false;
                }
            }        private void Form1_MouseDown(object sender, MouseEventArgs e)
            {
                listBox1.Visible = false;
            }
    试试这代码.不知道你是不是要这种效果.没有用COMBOBOX.