private void BtnDeleteEmployee(object sender, RoutedEventArgs e) { Employee emp = new Employee(); emp.EmpID = Int32.Parse(txtEmpId.Text); string msg = da.DeleteEmployee(emp); MessageBox.Show("" + msg); if (msg.Equals("Employee Discontinued")) { MainWindow mw = Application.Current.Windows.OfType <MainWindow>().FirstOrDefault(); if (mw != null) { mw.MainFrame.Content = new ManageEmployees(); } } }