RE: Application.Run
- From: swashi <swashi@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 4 Aug 2005 06:21:15 -0700
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());
}
"VISHAL" wrote:
> 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.
>
> I dont want to use show dialog box.I would like to use application.run for
> both the forms.
>
> Please let me know what is a good way to do it.
> Any help is highly appreciated.
>
> Thanks
.
- References:
- Application.Run
- From: VISHAL
- Application.Run
- Prev by Date: Re: TransparencyKey bug (workaround in KB822495)
- Next by Date: ErrorProvider error with xp Manifest file
- Previous by thread: Application.Run
- Next by thread: Changing ComboBox State from within SelectedIndexChanged
- Index(es):