Click here to Skip to main content
15,890,527 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
My Boss ask the he wants to have a Blinking label so im sure that i will use here a timer.

can someone give me a code that will set the label visible to true and set the label visible again to false every second (vice versa)using a timer

this is urgent please help

sir sergev
Posted
Comments
Pheonyx 5-Jun-13 5:32am    
Have you bothered to try anything? is this windows forms? web? WPF?
Crixalis Paul 5-Jun-13 5:33am    
vb.net windows form sir
Crixalis Paul 5-Jun-13 5:40am    
TY for the code

1 solution

1) Add a timer object to your form (I believe it is under "Components" in the toolbox)
2) Set its interval to 1000 (it is in milliseconds
3) Add an event handler to its "Tick" event
4) In the event handler put something similar to:

VB
mylabel.Visible = Not mylabel.Visible


5) Set the timer to enabled

That should do the job.

Or you could make a custom control "MyBlinkingLabel" add a label and a timer to that so that it is all encapsulated in one place.

Or you could do the timer control bits in code.

There are various options available to you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900