Firstly you need to drag the Timer from the toolbox to the design.
Under Initialize Component, put this code.
timeLeft = 20
timer1.Start();
You can set how many seconds your splash screen will appear. For this code, I use 20 seconds.
Don't forget to declare the variable timeLeft. You can put this code anywhere.
public int timeLeft { get; set; }
Then double click on the Timer and put this code.
if (timeLeft >0)
{
timeLeft = timeLeft - 1;
}
else
{
timer1.Stop();
new login().Show();
this.Hide();
}
For this example, after the splash screen disappears after 20 seconds, the login form will show.
Thank you for reading and feel free to give your opinion or correct me if there is anything wrong with my post.
Under Initialize Component, put this code.
timeLeft = 20
timer1.Start();
You can set how many seconds your splash screen will appear. For this code, I use 20 seconds.
Don't forget to declare the variable timeLeft. You can put this code anywhere.
public int timeLeft { get; set; }
Then double click on the Timer and put this code.
if (timeLeft >0)
{
timeLeft = timeLeft - 1;
}
else
{
timer1.Stop();
new login().Show();
this.Hide();
}
For this example, after the splash screen disappears after 20 seconds, the login form will show.
Thank you for reading and feel free to give your opinion or correct me if there is anything wrong with my post.
Comments
Post a Comment