combobox选择一个值,将值显示在textbox中,如何实现多次选择的结果都显示在其中,用“,”隔开。

解决方案 »

  1.   

    每次选择的结果,通过字符串拼接显示到textbox中即可啊,判断textbox中是否有内容,有内容,
    textbox.Text = textbox.Text + "," + combobox.Text;
      

  2.   


            private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
            {
                textbox.Text = textbox.Text + "," + combobox.Text;
            }
      

  3.   


            private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
            {
               if(textbox.Text.Trim()!="")
               {
                  textBox1.AppendText("," + combobox.Text);              
               }
               else
               {
                  textbox.Text =combobox.Text;
               }
            }
      

  4.   

     textBox1.Text += comboBox1.Text + ",";
    textBox1.SelectionStart = textBox1.Text.Length;//避免光标在输入字母的前面
    这个是按照添加顺序显示。最后处理一下最后一位是,
      

  5.   


    private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
            {
                textbox.Text += "," + combobox.Text;
            }
      

  6.   

    哦 我意思是想显示到comboBox1.Text里面行不通! 应该如何做,才能把串接好的内容显示到comboBox1.Text里面?而而不是显示到另外一个控件里面。