In Program.cs keep Login as starting form
Application.Run(new LoginForm());
In Login Form Put the following code ….
Step 1: using System.Threading;
Step 2: Put the Code in Valid Login Section
private void btnLogin_Click(object sender, System.EventArgs e)
{
// On Valid Login
this.Close();
Thread th = new Thread(new ThreadStart(myForm));
th.Start();
}
Step 3: Create the Function to open the next form
//
private void myForm()
{
Form2 f = new Form2();
f.ShowDialog();
}
Reference : http://www.dotnetspider.com/forum/16780-closing-form.aspx
In Program.cs keep Login as starting form
Application.Run(new LoginForm());
In Login Form Put the following code ….
Step 1: using System.Threading;
Step 2: Put the Code in Valid Login Section
private void btnLogin_Click(object sender, System.EventArgs e)
{
// On Valid Login
this.Close();
Thread th = new Thread(new ThreadStart(myForm));
th.Start();
}
Step 3: Create the Function to open the next form
private void myForm()
{Form2 f = new Form2();
f.ShowDialog();
}
Reference : http://www.dotnetspider.com/forum/16780-closing-form.aspx