在删除listboxB的选择项时总是删除该选择项的前一项??

解决方案 »

  1.   

    设置ListBox的AutoPostBack属性为True就可以了。
      

  2.   

    设置ListBox的AutoPostBack属性为True时选择itemA时就自动跑到itemA-1项
      

  3.   

    remove(lisbboxB.items[listboxB.selectindex])和remove(listbox.selectitem)都试过了不行
      

  4.   

    你是这个意思吗?添加
    ===================
    private void comboBox1_SelectedIndexChanged(object sender, System.EventArgs e)
    {
       if(!this.comboBox2.Items.Contains(this.comboBox1.SelectedItem))
              this.comboBox2.Items.Add(this.comboBox1.SelectedItem);
    }
    删除
    =====================
    private void button_Click(object sender, System.EventArgs e)
    {
     this.comboBox2.Items.Remove(this.comboBox2.SelectedItem);
    }
    这段代码在我这里运行很正常啊