Skip to main content

Write a VB program to design Traffic signal using shape control.

· One min read
Kaustubh Kulkarni
file.vb
Private Sub Timer1_Timer()  
If Shape3.BackColor = vbGreen Then
Shape2.BackColor = vbYellow
Shape3.BackColor = vbWhite
Timer1.Interval = 500
ElseIf Shape2.BackColor = vbYellow Then
Shape1.BackColor = vbRed
Shape2.BackColor = vbWhite
Timer1.Interval = 5000
Else
Shape3.BackColor = vbGreen
Shape1.BackColor = vbWhite
Timer1.Interval = 3500
End If
End Sub