Flashing Label

Phil_C

Newcomer
Joined
Mar 21, 2003
Messages
11
Location
Australia
How would I go about getting a timer to flash a label on and off four times? I use the following code to flash the label but I don't know how to stop it from flashing after four times.

With tmrLabelFlash
.Interval = 500
.Enabled = True
label.Visible = Not label.Visible
End With

Thanks in advance

Phil C
 
I put this code together quickly but, i used vb6 not .net , however i'm sure you'll get the idea...
Visual Basic:
Option Explicit

Dim strStart As Integer

Private Sub Command1_Click()
strStart = 0
Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()
strStart = strStart + Timer1.Interval
If strStart > 2000 Then 'IF FLASH OCCURS 4 TIMES BASED ON TIMER SET AT 500 MILLI SECONDS THEN QUIT
   Timer1.Enabled = False
   Timer2.Enabled = False
Else:
   Label1.Visible = True
   Timer2.Enabled = True
End If
End Sub

Private Sub Timer2_Timer()
    Label1.Visible = False 'SWITCH LABEL TO HIDDEN READY FOR NEXT FLASH.
    Timer2.Enabled = False
End Sub
that basically turns on a label ( makes it visible, then after 100 milliseconds the second timer hides it again )
hope this helps:)
 
Back
Top