问题是这样的,我把ListBox的SelectedMode设置成了多选,即Multiple。
但是我在使用ListBox的SelectedValue这个属性的时候,不能获取我多选后的结果,这是为什么!?

解决方案 »

  1.   

    你可以通过SelectedItems或者SelectedIndices来进行访问。
      

  2.   

    string str;
    for(int i=0;i<ListBox1.Items.Count;i++)
    {
    if(ListBox1.Items[i].Selected==true)
    {
    str+=ListBox1.Items[i].Value+",";
    }
    }
    str为多选的值
      

  3.   

    string aa="";
    for(int m=0;m<this.listBox1.SelectedItems.Count;m++)
    {
    aa =aa + this.listBox1.SelectedItems[m].ToString();
    }