Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6959373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:15:49+00:00 2026-05-27T15:15:49+00:00

This question might sound simple but I can’t find the answer i’m looking for.

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T15:15:50+00:00Added an answer on May 27, 2026 at 3:15 pm

    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.

    • You could pass the reference in to the Main from FROM the login form when you show it.
    • You could keep a global reference to the Login Form. (think singleton)
    • any other way you can think of

    For example:

    public class MainForm : Form
    {
        Form loginform;
        public MainForm(Form loginForm)
        {
            this.loginForm = loginForm;
        }
    
        public void CloseForms()
        {
            loginForm.Close();
            this.Close();
        }
    }
    

    In your Active() method, just pass the login form in. Alternatively you can use the code above, and just pass this into the constructor instead of the Active() method.

    public class MainForm : Form
    {
        Form loginform;
        public Active(Form loginForm)
        {
            this.loginForm = loginForm;
        }
    
        public void CloseForms()
        {
            loginForm.Close();
            this.Close();
        }
    }
    
    //from the LOGIN form
    if (access)
        {
            Main_Form mainForm = new Main_Form();
            mainForm.Visible = true;
             mainForm.Activate(this); //this is a reference to the current form. LOGIN in this case
    
         }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this might sound like a daft question but I can't seem to find a
This might sound like a reaaaally dumb question but... why do browsers have a
This might sound like a little bit of a crazy question, but how can
This might sound kinda strange question but I am puzzled. I was just looking
I know this question might sound a little cheesy but this is the first
This might sound like a stupid question, but google didn't help me. Is there
This might sound a bit of an odd question but I know what I
This question might be kind of elementary, but here goes: I have a SQL
Now this might sound simple, but I'm a bit mixed up. I am trying
This might sound to be a big question, but could you specify what are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.