private void BtnDeleteSupplier(object sender, RoutedEventArgs e) { DataAcces da = new DataAcces(); Supplier s = new Supplier(); s.SupplierID = Int32.Parse(txtSupId.Text); string msg = da.DeleteSupplier(s); MessageBox.Show("" + msg); if (msg.Equals("Supplier Discontinued")) { MainWindow mw = Application.Current.Windows.OfType <MainWindow>().FirstOrDefault(); if (mw != null) { mw.MainFrame.Content = new ManageSuppliers(); } } }