Learn Visual Basic 6.0(VB6)- Road Traffic lights Demonstration App Using Timer and Shape Control
as we know that how traffic lights works..
But in this video demonstration, following issues i.e
*How will you design the Traffic light using Shape control.
*How will you make the traffic lights functional using timer control.
for more Visual Basic tutorials,please visit http://selfcomputerlearning.blogspot.in/
Please like and comments:-)
Source Code:
Private Sub Timer1_Timer()
Static state As Integer
Select Case state
Case 0
shpred.BackColor = vbRed
shpyellow.BackColor = vbWhite
shpgreen.BackColor = vbWhite
lblmsg.Caption = "Stop"
lblmsg.forecolor=vbred
Timer1.Interval = 7000
state = 1
Case 1
shpred.BackColor = vbWhite
shpyellow.BackColor = vbYellow
shpgreen.BackColor = vbWhite
lblmsg.Caption = "Wait"
lblmsg.forecolor=vbyellow
Timer1.Interval = 2000 state = 2
Case 2 shpred.BackColor = vbWhite
shpyellow.BackColor = vbWhite
shpgreen.BackColor = vbGreen
lblmsg.Caption = "Go"
lblmsg.forecolor=vbgreen
Timer1.Interval = 5000
state = 0 End Select End Sub
Please Comments and Share