how to create login screen in windows application + SQL

  • Thread starter Thread starter alfata
  • Start date Start date
A

alfata

hi there

i'm new to c sharp and i would like to learn more about it and
design the first form LOGIN so that i put admin user and pasword


i tried everything with no luck so i come here to get some help from
you guys

thanks
 
You can run your Logon form firt in Main event. Here is an example:

private static bool StateLogIn = true;
private static void Main()
{
// main form
MainForm thisForm = new MainForm();
// login form
Login frmLogin = new Login();
// show login form first, force user to logged on system
frmLogin.ShowDialog();
if (StateLogIn)
{
StateLogIn = false;
if (frmLogin.DialogResult == DialogResult.OK)
{
Application.Run(thisForm);
}
else
{
Application.Exit();
}
}
else
{
if (frmLogin.DialogResult == DialogResult.OK)
{
thisForm.Visible = true;
}
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top