.Net得到选中的ListBox[多选]的值

string strShipMethodslist = string.Empty;
                    foreach (int i in lbshipMethods.GetSelectedIndices())
                    {
                        strShipMethodslist += lbshipMethods.Items[i];
                    }

  string temp = string.Empty;
        foreach (ListItem li in ListBox1.Items)
        {
            if (li.Selected == true)
            {
                temp = "," + li.Value;
            }
        }
        temp = temp.Substring(1);

posted @ 2008-12-03 14:02  roboth  阅读(793)  评论(1编辑  收藏  举报