I have need to make a splash screen with a progress bar. My problem is that I cannot link the main form with the splash screen:
public LogIn_Form() {
Thread t = new Thread(new ThreadStart(SplashStart));
t.Start();
Thread.Sleep(5000);
InitializeComponent();
t.Abort();
}
public void SplashStart() {
Application.Run(new Form1());
}
Where I have "Application.Run(new Form1());" it gives me an error under Form1.
This is the splash screen form:
public SplashScreen_Form() {
InitializeComponent();
timer.Start();
}
private void timer_Tick(object sender, EventArgs e) {
this.Opacity += 0.07;
pbrLoad.Increment(1);
if (pbrLoad.Value == 100)
timer.Stop();
}
private void SplashScreen_Form_Load(object sender, EventArgs e) {
this.Opacity = 0;
timer.Enabled = true;
}
Now I need to keep it like that but with no errors.