private void btnDelete_Click(object sender, EventArgs e) { if (MessageBox.Show("Do You really want to delete this Client?", "DELETE", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { int refclient = (int)gridAll.Rows[gridAll.CurrentRow.Index].Cells[0].Value; if (admin.Delete_Client(refclient)) { MessageBox.Show("House ID" + refclient + " is successfully Deleted", "House Deleted"); } else { MessageBox.Show("House ID " + refclient + " is not deleted.", "Try Again"); } } admin.Refresh_Database(); if (permission != 2) { gridAll.DataSource = admin.All_Client(); } else { List <clsClient> temp = new List <clsClient>(); temp.Add(agent.Searched_Cleint_For_This_Agent(refagent)); gridAll.DataSource = temp; } ButtonControl(true, true, false, false, true, false); }