Skip to main content

How to create splash screen using timer in Visual Studio 2017 with C#

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.

Comments

Popular posts from this blog

Simple Sign Up / Registration Windows Form with C# (With Hash)

Design your own registration form. Below is the example of a simple registration form. Then create a table in the database (I will post about how to create the table in the SQL database and connect to Visual Studio later).  Open the coding page and ensure that all these using directives are placed on top of the coding page. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Text.RegularExpressions; using System.Data.SqlClient; using System.Security.Cryptography; using System.IO; Then double click on the Sign Up button connection.Open();           SqlCommand command = new SqlCommand("INSERT INTO YourTableName (fullname,username,[password]) VALUES (@nm, @un, @up)", connection); command.Parameters.AddWithValue("@nm", txtfullname.Text)...

Auto Increment ID in Database & Visual Studio

Auto increment is used when we want the ID to update itself automatically. Click on the ID column. Ensure that the data type is int and unchecked Allow Nulls Go to the Properties and search for Identity Specification > Is Identity . Choose True then you are done!  Thank you for reading and feel free to give your opinion or correct me if there is anything wrong with my post.