private void button2_MouseClick(object sender, MouseEventArgs e) { FormularioPrincipal pant = new FormularioPrincipal(); this.Visible = false; pant.Owner = this; pant.ShowDialog(); pant.Dispose(); }
//lo que sucede cuando la pantalla de administrador se cierra private void PantallaAdministradorAlmacén_FormClosed(object sender, FormClosedEventArgs e) { FormularioPrincipal form = (FormularioPrincipal)this.Owner; //Console.WriteLine("Cierra sesion admin"); //this.Owner.Enabled = true;//el padre se activa ((FormularioPrincipal)this.Owner).limpiarCampos(); MessageBox.Show("Su sesión se cerró correctamente", "Éxito"); form.Visible = true; this.Owner = null; }