我想点击button的时候  修改ListBox里选中项的文字
我在按钮的点击事件里加了一下代码 为什么没效果啊:
   this.listBox1.selectedItem="sdfsdf";忘高手指点下 谢谢!

解决方案 »

  1.   

    你焦点在Button上,把ListBox的HideSelection属性修改为False
      

  2.   

    ListBox 没HideSelection 这个属性啊?
      

  3.   

    sorry我当是ListView了, 你改为:this.listBox1.selectedValue = "sdfsdf"; 
      

  4.   

    Text 还是不行  郁闷死我了 
      

  5.   

    this.listBox1.SetSelected(3, true);
      

  6.   

    this.listBox1.SelectedIndex = 3 也行。
      

  7.   

            private void button1_Click(object sender, EventArgs e)
            {
                int idx = listBox1.SelectedIndex;
                listBox1.Items.RemoveAt(idx);
                listBox1.Items.Insert(idx, "NEW");
            }我的笨方法:把你的当前选中项给remove了,再重新insert一个
      

  8.   


    private void button1_Click(object sender, EventArgs e)
            {
                listBox1.Items[listBox1.SelectedIndex] = "要更改的字符";
                listBox1.Refresh();
            }