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
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:
To close form you should call
Closemethod. When you callHideor setVisibilityto 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:
Then subscribe to
Loadevent of Main_User form. And in the event handler do following:UPDATE: You can do this all in Main method, like this way
but usually I don’t hide main form and show it below login form. So, in this case you should use
Loadevent 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.