This question might sound simple but I can’t find the answer i’m looking for.
I have a Login_Form and a Main_Form.
Once I log into the Main_Form I just make it visible and I activate it because I don’t want my Login_Form to close.
My question is, is there a way to close both forms at the same time from the Main_Form?
The this.Close(); will only close the current form.
if (access)
{
Main_Form mainForm = new Main_Form();
mainForm.Visible = true;
mainForm.Activate();
}
This is where I Instantiate the main_form how can I pass a reference to the login_form?
Thanks in advance and remember the Login_Form must remain open until I close it from the Main_Form!
Feedback
After looking at which of your answers I would use I found out about the Application.Close() Method Which closes all the forms. Should have taught about this before posting here thanks everyone.
If your Main form has a reference to the Login form you can call the close method on it. How you do that is up to you.
For example:
In your Active() method, just pass the login form in. Alternatively you can use the code above, and just pass
thisinto the constructor instead of the Active() method.