关于listview
怎样删除listview控件里选中的内容
[解决办法]
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); } }