日期:2014-05-18 浏览次数:20536 次
if (this.listView1.SelectedItems.Count > 0) { foreach (ListViewItem item in this.listView1.SelectedItems) { this.listView1.Items.Remove(item); } }
------解决方案--------------------
前面加一个不为空的判断
if (this.listView1.SelectedItems!=null && this.listView1.SelectedItems.Count > 0) { foreach (ListViewItem item in this.listView1.SelectedItems) { this.listView1.Items.Remove(item); } }