private void supplierPermanentlyDeleteButton_Click(object sender, EventArgs e) { if (MessageBox.Show(rs.GetString("deletePermanentlyAccountYesNoMsg"), rs.GetString("deleteTitle"), MessageBoxButtons.YesNo) == DialogResult.Yes) { int count = 0; for (int i = supplierListDataGridView.Rows.Count - 1; i >= 0; i--) { bool delete = (bool)supplierListDataGridView.Rows[i].Cells["SelectedSupplierColumn"].Value; if (delete == true) { sda.permanentlyDelete((string)supplierListDataGridView.Rows[i].Cells["SupplierIDColumn"].Value, conn); supplierListDataGridView.Rows.Remove(supplierListDataGridView.Rows[i]); count++; } } if (count == 0) MessageBox.Show(rs.GetString("selectAccountMsg"), "", MessageBoxButtons.OK, MessageBoxIcon.Information); else { if (supplierListDataGridView.Rows.Count > 0) { supplierSelectAllButton.Enabled = true; supplierDeselectAllButton.Enabled = true; supplierRecoverButton.Enabled = true; supplierPermanentlyDeleteButton.Enabled = true; } else { supplierSelectAllButton.Enabled = false; supplierDeselectAllButton.Enabled = false; supplierRecoverButton.Enabled = false; supplierPermanentlyDeleteButton.Enabled = false; } supplierListDataGridView.ClearSelection(); MessageBox.Show(rs.GetString("deletePermanentlyAccountMsg")); } } }