我在用ListBox时,可以多选删除。不知道各位有没有比较好的删除方案,我试了好多方法都无效,可以删除不过就是报出其它的错误。所以我花了一个小时想出此方案,实用!
public void DeleteSelectedItems(ListBox listbox1)
{
ArrayList al =new ArrayList();
  IEnumerator  myEnumerator=listbox1.SelectedItems.GetEnumerator();
   //记录选中的单号
   while(myEnumerator.MoveNext())
   {
    al.Add(myEnumerator.Current);
   }
   //删除选中的单号
   foreach(string str in al)
   {
   listbox1.Items.Remove(str);
   }
}

相关文章:

  • 2021-08-10
  • 2021-06-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-17
  • 2021-05-13
  • 2021-10-03
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-26
  • 2022-12-23
  • 2021-09-02
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案