private void deleteButton_Click(object sender, EventArgs e) { if (MessageBox.Show(rs.GetString("deleteAccountYesNoMsg"), 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.delete((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) { deleteButton.Enabled = true; deselectAllButton.Enabled = true; selectAllButton.Enabled = true; } else { deleteButton.Enabled = false; deselectAllButton.Enabled = false; selectAllButton.Enabled = false; } supplierListDataGridView.ClearSelection(); resetFormButton_Click(null, null); MessageBox.Show(rs.GetString("deleteAccountMsg")); } } }