I have a problem with this piece of code, which loads a splash screen and keeps it open for 5 seconds before loading another form.
It strangely seems to be repeatedly running a thread once the method has executed and showing an unlimited number of splash screens but no main form. I've tried inserting mb.Suspend() and mb.Abort() after requesting the ShowDialog() method to be run for my main form, Form1.
How can I stop the thread from repeatedly running?
Cheers
Matt
It strangely seems to be repeatedly running a thread once the method has executed and showing an unlimited number of splash screens but no main form. I've tried inserting mb.Suspend() and mb.Abort() after requesting the ShowDialog() method to be run for my main form, Form1.
How can I stop the thread from repeatedly running?
Cheers
Matt
Code:
protected override void OnLoad(EventArgs e)
{
SplashIntro s = new SplashIntro();
Thread mb = new Thread(new ThreadStart(StartSplash));
mb.Start();
Thread.Sleep(5000);
bool authenticated = s.AuthenticateUser();
if (s.AuthenticateUser() ? true : false)
{
Close();
Form1 f1 = new Form1();
f1.Size = new Size(1060, 770);
f1.ShowDialog();
}
else
{
Application.ExitThread();
}
s.Close();
s.Dispose();
s = null;
}
Comment