Hello, is there anything wrong with the below code? i want to blink
any of the for labels if the back color is LimeGreen.
Timer5 is enabled already and starts at form closing event of another for.
so on the timer tick i have below code.
thanks for your help

Dim time2 As Integer

    Private Sub Timer5_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer5.Tick

        If (time2 = 1) And Label17.BackColor = Color.LimeGreen Then
        End If

        If (time2 = 2) And Label17.BackColor = Color.LimeGreen Then
            time1 = 0
        End If

        If (time2 = 1) And Label18.BackColor = Color.LimeGreen Then

        End If

        If (time2 = 2) And Label18.BackColor = Color.LimeGreen Then

            time1 = 0
        End If

        If (time2 = 1) And Label19.BackColor = Color.LimeGreen Then
        End If

        If (time2 = 2) And Label19.BackColor = Color.LimeGreen Then
            time1 = 0
        End If

        If (time2 = 1) And Label20.BackColor = Color.LimeGreen Then
        End If

        If (time2 = 2) And Label20.BackColor = Color.LimeGreen Then
            time1 = 0
        End If

        time1 += 1

    End Sub

Recommended Answers

All 3 Replies

Use Visible property instead of Bringtofront


'Label17.SendToBack() - Dont use that. Use
'And for opposite just use

ok ok.. good. thanks

i think you done wrong thing in tick event , you can just check it like this

if Label17.BackColor = Color.LimeGreen then 
' your code 
end if 
' this condition always checked by the timer at its every tick event , now you can just set the interval of your timer as you want.

please if i am wrong then do tell me.


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.