In order to open the second form using the Application.Run, once the user
successfully logs in, exit from the thread on which login form is running
using
'Application.ExitThread()' and spawn a new thread. The thread will be
spawned using System.Threading.Thread. Now another form can be run using
Application.Run on newly spawned thread.
Sample Code:
The following code for the button click event of the 'login button' enables
the user to log in and run the second form using Application.Run as well.
System.Threading.Thread td;
private void button1_Click(object sender, EventArgs e)
{
if(this.textBox1.Text=="a" && this.textBox2.Text=="a")
{
Application.ExitThread();
Thread td = new Thread(new ThreadStart(ss));
td.Start();
}
}
protected void ss()
{
MessageBox.Show("new thread is running");
Application.Run(new Form2());
}
> I am developing a windows form with a login screen.Once a user succesfully
> logs in,I want to close the login screen and run the main application.
[quoted text clipped - 6 lines]
>
> Thanks