private void button1_Click_1(object sender, EventArgs e) { for (int i = 0; i < BadConPhotos.Items.Count; i++) { BadConPhotos.SetItemChecked(i, false); } }
private void deleteBtn_Click(object sender, EventArgs e) { Boolean degel; degel = true; //---------(new)----------------adding all items to delete into list---- if (BadConPhotos.Items.Count == BadConPhotos.CheckedItems.Count) { //MessageBox.Show("You chose all the copys of the picture to delete,\n it means you will lose that picture completely\n "); const string message = "You chose to delete all photos,\n it means you will lose that picture completely. \n\nARE YOU SURE THAT YOU WANT TO DO THESE?"; const string caption = "Deleting options"; var result = MessageBox.Show(message, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Warning); // If the no button was pressed ... if (result == DialogResult.No) { return; } } for (int i = 0; i < BadConPhotos.Items.Count; i++) { degel = true; if (BadConPhotos.GetItemChecked(i)) { foreach (string item in itemsToDelete) { if (item == BadConPhotos.Items[i].ToString()) { degel = false; } } if (degel == true) { itemsToDelete.Add(BadConPhotos.Items[i].ToString()); } } } if (degel == true) { MessageBox.Show("The files moved to a delete list, to be deleted on next step."); } //---------------------------------------------------------------------- }