private void submit_click(object sender, RoutedEventArgs e) { try { bool match = false; UsersBL p = new UsersBL(); string login_txt = LoginId_txt.Text; string pass_txt = txt_Password.Password; match = p.AdminLogin(login_txt, pass_txt); if (match) { MessageBox.Show("Login Succesfull"); AdminProgramOffered admin = new AdminProgramOffered(); admin.Show(); this.Close(); } else { throw new UniversityException("Wrong Credentials"); } } catch (UniversityException ex) { MessageBox.Show(ex.Message); } }