private void metroButton1_Click(object sender, EventArgs e) { try { if (validateentries()) { clsdept.Name = txtname.Text.ToUpper(); clsdept.ShortName = txtshortname.Text.ToUpper(); clsdept.Description = txtdescription.Text; clsdept.FacultyID = int.Parse(cmbfaculty.SelectedValue.ToString()); clsdept.Created_By = user; clsdept.newDepartment(); message = clsdept.ErrorMessage + ". Would you like to add new department"; DialogResult dialogResult = MessageBox.Show(message, "Success", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (dialogResult == DialogResult.Yes) { clearentry(); } else { this.Close(); } } else { MessageBox.Show("Oops! Spomething went wrong"); return; } } catch (Exception ex) { throw new ArgumentException(ex.ToString()); } }