Hello, I have an MDI form (frmPrincipal) where I open an MDI Children form (frmListadoClientes).
Within this mdi children when closing the form I launch a form (frmOptions) that allows you to do a couple of quick actions that you can either click on one of them or cancel the form.
If the frmOptions is canceled, the frmListadoClientes remains in modal
If one of the frmOptions buttons is activated, a 4th form (frmTPV) is opened, so I try to hide the third form (frmOptions) and show this last open form in a modally way, for this I use this code
Code to open the Options form
frmOpciones frm = new frmOpciones (param1 , param2);
frm.ShowDialog();
From the frmOptions form (3rd form) I open the corresponding option for this, the 4th form is opened and I launch it with this code
private void btnStock_Click(object sender, EventArgs e)
{
this.Close();
Form f2 = new frmTPV(param1 , param2 , param3);
f2.MdiParent = this.ParentForm;
f2.ShowDialog();
}
Here what I am trying to do is that before launching this 4th form I close the third one but I can't, I have also tried with a this.Hide() without success.
The problem I have is how to make this form not show or hide.
Thank you
Hi, the following has worked for me:
Tell me if it worked for you.
Cheers!!
Good,
What you are trying to do is like a menu window where you choose what action to perform and open one window or another depending on the button that is clicked.
The easiest way to perform this action is by calling the frmOptions form from the frmPrincipal and depending on the button that is clicked, the same form returns a variable so that frmPrincipal interprets it and opens the desired form, and in this way you make sure which will be opened with that MDI and frmOptions will be closed:
Code for frmOptions:
POS click event:
Code for frmPrincipal:
I hope it helps.