Make Animated/Blinking Label in VB.NET using Timer in 5 Easy Steps
Step 1: Add a Label.
Step 2: Add a Timer.
Step 3: Go to the Form_Load or the Load Event of the Form by double-clicking it then add the codes below. (Codes inside here will execute once the form was loaded.)
Timer1.Start() Label1.ForeColor = Color.RedStep 4: Go to the Timer1_Tick or the Tick Event of the Timer by double-clicking it then add the codes below. (Codes inside here will execute once the timer starts ticking.)
Timer1.Enabled = TrueTimer1.Interval = 100 'Expressed as 0.1 second.You can change this on how fast you want your label to change its color.
If Label1.ForeColor = Color.Red ThenLabel1.ForeColor = Color.YellowElseIf Label1.ForeColor = Color.Yellow ThenLabel1.ForeColor = Color.BlueElseIf Label1.ForeColor = Color.Blue ThenLabel1.ForeColor = Color.VioletElseIf Label1.ForeColor = Color.Violet ThenLabel1.ForeColor = Color.RedEnd If
Step 5: Run the program and see what happens.
If this post helped you please take a few seconds to share it! :)
are this coding function if using at aspnet website
ReplyDeleteThank you..
ReplyDelete