Saturday, 29 December 2012 13:56

how to create login by running multiple subsequent forms in c#

Written by 
Rate this item
(0 votes)

it is possible to run Application.Run twice in csharp
application.the following example shows that.it's a
example to create login to access the application.

first a login form is created with the username and
password texboxes and two buttons login and
cancel.these button handlers sets the DialogResult
property for the form.here login button sets it to
DialogResult.Ok and cancel button sets it to
DialogResult.Cancel.

the main program.cs file does all as follows -

static class Program
{
private static FormSplash formSplashObj = null;

[STAThread]
static void Main()
{
//Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);

formSplashObj = new FormSplash();
Application.Run(formSplashObj);
if (formSplashObj.DialogResult == DialogResult.OK)
{
Application.Run(new MainForm());
}
}
}

the above program responsible for running the splash
form and when it quit, the program determines
whether it will exit the application or run next form.
so this provide a login for the application.

Read 2853 times
Super User

Email This email address is being protected from spambots. You need JavaScript enabled to view it.

Latest discussions

  • No posts to display.