المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : the proper way to make a login screen appear in the main class - Main() - program.cs



C# Programming
08-21-2009, 01:31 AM
this code below, show first 1 screen and if you close 'login screen' the 'new Form1' gets created and shown.

static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new loginscreen.LoginScreen());
Application.Run(new Form1());
}


the code below works fine, but i would like to know witch property of the 'login' class i need to detect if the login window has been closed and finalize the class and then open the main window of the application (new Form1).

static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
loginscreen.LoginScreen login = new loginscreen.LoginScreen();
login.Show();

if(login. // need work here
{
Application.Run(new Form1());
}
else
{
// login failed after 3 attemps, close the whole app
Application.Exit();
}
}



how to detect or witch property of the login class tells me the login window is closed.

kind regards

Bad = knowing 2 much