private void deleteSimpleButton_Click(System.Object sender, EventArgs e) { if (machineLineGridView.SelectedRowsCount > 0) { if (MessageBox.Show("Are you sure you want to delete this record/s?", "Delete Record", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { for (int i = 0; i < machineLineGridView.SelectedRowsCount; i++) { int row = machineLineGridView.GetSelectedRows()[i]; if (row >= 0) { if (m_MachineLines.DeleteMachineLine(Convert.ToInt32(machineLineGridView.GetRowCellValue(row, idGridColumn))) != true) { MessageBox.Show("The Machine Line/s was not deleted successfully.", "Error Encountered", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } } } } BindGridControl(); }