I have a login form and the other form which contain the operation to be perform
In login form Submit Button, i am validating the emp code from database
If it is proper then i am writing


frm is the second form to be shown
My application is running fine
After successful operation i am asking the user to close the application if yes it closes
But it still running in the background as i see in task manager
I am not getting what is going on

If you want to exit from project then use


rather than



While closing Check the open login form like this way

foreach (Form ab in Application.OpenForms)
                 if (ab is LoginForm)


Another option is to open the main application form when the application starts (the frm form) and immediately hide it, and then show the login form. That's what I usually do.