private void addnewdepartmentsave_Click(object sender, EventArgs e) { if (addnewdepartmentidtext.Text != "" && addnewdepartmentnametext.Text != "") { try { dept.departmentId = addnewdepartmentidtext.Text; dept.departmentName = addnewdepartmentnametext.Text; if (deptd.insertDepartment(dept)) { MessageBox.Show("New Department Added Successfully."); button1_Click(sender, e); } else { MessageBox.Show("New Department Not Added."); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { MessageBox.Show("Empty Input."); } }