Click here to Skip to main content
15,918,003 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to show mainform after successful login.
form2.show()
me.close()

terminate full program
i hate to do
form2.show()
me.hide()

any other solution rather than this
Posted
Updated 23-Jan-12 18:41pm
v2

Hi,

Move the code out of your login form into the "Program.cs" file.
When your program first starts, you'll create and show the login form as a modal dialog.

As like the below one

C#
static void Main()
{
    LoginForm frmLog = new LoginForm();
    if (frmLog.ShowDialog() == DialogResult.OK)
    {
        Application.Run(new Form2());
    }
    else
    {
        Application.Exit();
    }
}
 
Share this answer
 
IN project menu last menu properties of project change shutdown mode to last form closes ......and coding = form2.show()and me.close()
 
Share this answer
 
Just set project property, shutdown mode to "when last form closes"
 
Share this answer
 
if successfully logged in,

frmMain.Show()
frmLogin.Close()

is your question answered?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900