firstly you will need 3 picutre boxes going in a downward pattern and you will need to input a timer so that the colours will change in sequence and also you can add an End button if you want it to stop and close.
so your layout should look like that if you felt like being creative and making it look like a real (sort of) traffic lights.
so now that you have the layout sorted you will now need to start the coding so firstly open the code form and type Dim Counter As Single Then click on the Timer and type this code:
Dim Counter As Single
Private Sub Timer1_Timer()
Counter = Counter + 1
If Counter = 5 Then
Counter = 1
End If
If Counter = 1 Then
Picture1.BackColor = vbRed
Picture2.BackColor = vbWhite
Picture3.BackColor = vbWhite
End If
If Counter = 2 Then
Picture2.BackColor = &H80FF&
Picture1.BackColor = vbRed
Picture3.BackColor = vbWhite
End If
If Counter = 3 Then
Picture3.BackColor = &HC000&
Picture1.BackColor = vbWhite
Picture2.BackColor = vbWhite
End If
If Counter = 4 Then
Picture1.BackColor = vbWhite
Picture2.BackColor = &H80FF&
Picture3.BackColor = vbWhite
End If
End Sub
so this is the coding for traffic lights and if you want to add the end command in then click the Command button and type this code:
Private Sub cmdEnd_Click()
End
End Sub
And presto you have a working code for the traffic lights