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

  • Home
  • SEARCH
  • 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 7836955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T14:24:32+00:00 2026-06-02T14:24:32+00:00

why The process still on Windows Task list manager after close programme ? i

  • 0

why The process still on Windows Task list manager after close programme ?

i use login Form.cs

 [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Login());
        }

after the user succesuly login, i redirect to another Masterpage

 this.Hide();
            Main_Usr oMainUsr = new Main_Usr();                    
            oMainUsr.Visible = true;

my pseudo master page like this:

public Main_Usr()
        {
            InitializeComponent();
            this.IsMdiContainer = true;
        }

when i close the masterpage, The process still on Windows Task list manager.
But when i close the login page, it kill the process on Windows Task list manager.

is that mean because i just hide le login page ?
must i close all window to realy quit/kill the process ?

Thanks you in advance,
Stev

  • 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-02T14:24:34+00:00Added an answer on June 2, 2026 at 2:24 pm

    In winforms process will be killed, when main application form is closed. Main application form is one specified in Application.Run call. In your case it is Login form:

    Application.Run(new Login());
    

    To close form you should call Close method. When you call Hide or set Visibility to false, form stays in memory. It just becomes hidden from user.

    So, to achieve desired functionality you should change main application form to Main_Usr:

    static void Main()
    {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Application.Run(new Main_Usr()); // change main form
    }
    

    Then subscribe to Load event of Main_User form. And in the event handler do following:

    private void Main_User_Load(object sender, EventArgs e)
    {
        using (var loginForm = new Login())
        {
            Hide(); // hide main form
    
            if (loginForm.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                Close(); // close main form and kill process
                return;
            }
    
            Show(); // show main form if user logged in successfully 
        }
    }
    

    UPDATE: You can do this all in Main method, like this way

    static void Main()
    {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        using(var loginForm = new Login())
             if (loginForm.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                 return;
        Application.Run(new Main_Usr()); // change main form
    }
    

    but usually I don’t hide main form and show it below login form. So, in this case you should use Load event handler. It’s up to you.

    BTW there is no masterpages and pages in winforms. This all is for ASP.NET. Here you have forms 🙂
    Also consider naming like LoginForm, MainForm etc.

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

Sidebar

Related Questions

When we kill a process in Windows with Task Manager End Process command, will
I need to create running windows process (the one seen on task manager) when
We use Process Monitor (ProcMon) to monitor the w3wc.exe process on a Windows Server
I have read about storing session state out-of-process but still in memory by configuring
Attempting to implement a poor man's test of whether a process is still running
What happen if web.config gets updated while ASP (ASP.NET 2.0) server still process client
We currently use SQL Server, a BPM engine, win services, and even the Windows
My understanding is that when you kill a C++ application through Task Manager in
Simple task: Send a windows message with dynamically allocated data, e.g. an arbitrary length
I implemented an update process for a piece of software using the Windows scheduler.

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.