Close current windowsForm when opening next

Asked

Viewed 20 times

1

My current form is called Frmvender (The one that is open) when clicking a button inside the Frmvender, I want it (Frmvender) to close and open the form I call which in case is Frmvendaprint.

FrmVendaImprimir frmVendaImprimir = new FrmVendaImprimir()
this.Close();
frmVendaImprimir.Show();
frmVendaImprimir.Focus();

With this code, the current one (Frmvender) closes and the frmVendaImprimir opens, but the frmVendaImprimir goes behind the main window of my system, it does not get the focus on it. How do I fix it?

  • (ignoring the content) should do this in the form that opens the "sell"... taking into account, that is a sale and an impression, the impression should be within the sale... it does not make sense to close the sale screen to then print it

1 answer

1

You can use two commands to bring forward:

 frmVendaImprimir.BringToFront();

Or

 frmVendaImprimir.Activate();

Browser other questions tagged

You are not signed in. Login or sign up in order to post.