private void btnSave_Click(object sender, EventArgs e) { clsAdmin temp = new clsAdmin(); temp.UserID = txtID.Text.Trim(); temp.Name = txtName.Text.Trim(); temp.PhoneNumber = txtPhone.Text.Trim(); if (Addmode) { if (temp.Add_New_Admin(temp)) { MessageBox.Show("New Administrator " + temp.Name + " is successfully added", "New Admin"); } else { MessageBox.Show("Administrator " + temp.Name + " is not added.", "Try Again"); } admin.Refresh_Database(); } else { temp.RefAdmin = (int)gridAll.Rows[gridAll.CurrentRow.Index].Cells[0].Value; if (temp.Edit_Admin(temp)) { MessageBox.Show("Administrator " + temp.Name + " is successfully modified", "Admin Modified"); } else { MessageBox.Show("Administrator " + temp.Name + " is not edited.", "Try Again"); } } gridAll.DataSource = admin.Search_All_Admins(); ButtonControl(true, true, false, false, true, false); }