This must be very simple, but I do not manage to remove the selected items from the listview.
I am using:
ultraListView1.SelectedItems.Clear();
My listview is in detailed mode with 3columns.
Thanks for your help.
It seems as if you are expecting the line of code you posted to remove the selected items from the control's Items collection; it doesn't, it deselects them, i.e., removes them from the SelectedItems collection. You can use the UltraListView.Items.Remove method on each member of the SelectedItems collection to remove all selected items, as demonstrated by the following code sample:
this.listView.KeyDown += new KeyEventHandler(listView_KeyDown);
private void listView_KeyDown(object sender, KeyEventArgs e){ UltraListView listView = sender as UltraListView;
if ( e.KeyData == Keys.Delete ) { object[ selectedItems = listView.SelectedItems.All; listView.BeginUpdate();
for ( int i = 0; i < selectedItems.Length; i ++ ) { UltraListViewItem item = selectedItems as UltraListViewItem; listView.Items.Remove( item ); }
listView.EndUpdate(); }}