I have a problem regarding the loading screen I've created.
I execute the code run but after the progress bar is finished, the form is shown but closes automatically.
Why is this happening?
namespace LogIn
{
public partial class Loading : Form
{
public Loading()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
progressBar1.Increment(2);
if (progressBar1.Value == 100) timer1.Stop();
if (progressBar1.Value == 100)
{
this.Close();
Login Login = new Login();
Login.ShowDialog();
}
}
}
}