private void btnDelete_Click(object sender, EventArgs e) { if (MessageBox.Show("Do You really want to delete this House?", "DELETE", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { int refhouse = (int)gridAll.Rows[gridAll.CurrentRow.Index].Cells[0].Value; if (admin.Delete_House(refhouse)) { MessageBox.Show("House ID" + refhouse + " is successfully Deleted", "House Deleted"); } else { MessageBox.Show("House ID " + refhouse + " is not deleted.", "Try Again"); } } admin.Refresh_Database(); gridAll.DataSource = admin.Search_All_Houses(); ButtonControl(true, true, false, false, true, false); }