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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:59:43+00:00 2026-06-15T08:59:43+00:00

I have a game application in which when the game form is closed, a

  • 0

I have a game application in which when the game form is closed, a main menu always pops up.. therefore, all the application is supposed to stop running when a user closes the main menu form. I am trying to handle the Form_Closed event for the main menu and do Application.Exit() however this doesn’t seem to work even if all the forms are closed, the application is still running and I have to stop it manually.

This is the code I have in Game Form and Main Menu Form regarding closing:

IN GAME FORM:

private void GameForm_FormClosing(object sender, FormClosingEventArgs e)
{
    DialogResult dialogResult = MessageBox.Show("Are you sure you want to close this game?", "Exit Game", MessageBoxButtons.YesNo);

    if (dialogResult == DialogResult.Yes)
    {
        this.Hide();   // hide the Game Form

    }
    else if (dialogResult == DialogResult.No)
    {
        e.Cancel = true;    // cancel form closure
    }

}

private void GameForm_FormClosed(object sender, FormClosedEventArgs e)
{
    MainMenu menu = new MainMenu();
    menu.Show();
}

AND IN MAIN MENU FORM:

private void MainMenu_FormClosed(object sender, FormClosedEventArgs e)
{
    Application.Exit();
}

Am I doing something wrong, or is there something I should add for this to work?

  • 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-15T08:59:43+00:00Added an answer on June 15, 2026 at 8:59 am

    Considering that you are talking about gaming application, you make use of external resources or some game engine. Before exit from application, make sure you free/dispose/clean-up resources you used in your app.

    For example to keep track of open handles may use Handle

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

Sidebar

Related Questions

In my game application I have several different activities that all can be accessed
I have a card-game application which makes use of Single Table Inheritance. I have
I have a game application that I will be running in a web browser
I have a C# application which consists of 3 forms: 1: Battleship Game GUI
I have implement game application in which i want to play mid sound file
I am implementing game application.In which i have set UIView on camara overly.When i
Currently I have a flash based application (game) which I need to put on
Especially android-developers :) I have some troubles with application menu which i try to
I have a port of my application, a game, running on Mac OS X.
I have game application (cocos2d) in which, a ball is to be shooted from

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.