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 8331063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T02:18:24+00:00 2026-06-09T02:18:24+00:00

I have 2 forms ( main and login ). I open the login form

  • 0

I have 2 forms (main and login). I open the login form with this piece of code:

toolStripProgressBar1.Value = 50;
toolStripStatusLabel_dynamic.Text = "Proberen toegang te verkrijgen...";
Login login = new Login();
login.ShowDialog();
do_login();

And I have a toolstrip menu at the top of the login form with an eventhandler like this:

private void afsluitenToolStripMenuItem_Click(object sender, EventArgs e) {
    Application.Exit();
}

But after both forms are closed, the program continues to work (it calls the function do_login.) But the variables aren’t set, and the form is gone, so do_login won’t work at all…

So how will I make the whole execution of the program stop when I click the toolstrip?

  • 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-06-09T02:18:24+00:00Added an answer on June 9, 2026 at 2:18 am

    You’re going to have to work around it because the definition of Application.Exit() is as follows.

    Informs all message pumps that they must terminate, and then closes all application windows after the messages have been processed.

    So what it’s saying is once all messages have been fully processed it will exit, but since you have a message that needs processed after the dialog closes it has to finish that first. You are doing the exit properly, but you’re going to have to check for null and return if it is null in the do_Login() method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have three forms Main, Sales and Login. In Main form I have a
I have a login form, which needs to be re-directed to the main page
I have two Forms. One with where all the main code is being executed.
Scenario I have a Windows Forms Application. Inside the main form there is a
Scenario I have a C# Win Forms App, where the Main Form contains a
I have 2 windows form, 1 login form and 1 main form. I want
I have two forms in my project (Login and Main). What I'm trying to
I have 3 forms - the main form is Form1 the others are a
I have a OOP question. I have 3 classes. Program (main class), login form
Let's say I have a main form that can open MDI children inside it.

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.