Close Login Form and Open Another/Main Form
Posted by Jignesh on 16 October, 2009
No comments yet
This item was filled under [ Windows.Net ]
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 : [...]