September 12, 2014

Traffic Light demo in visual basic

Demo for Traffic Light application in visual basic







Dim db As Database
Dim rs As Recordset

Private Sub Command1_Click()
Timer1.Enabled = True
Timer5.Enabled = False
Timer3.Enabled = False
Timer2.Enabled = False
Timer4.Enabled = False
End Sub

Private Sub Command2_Click()
End
End Sub

Private Sub Form_Load()
Set db = opendatabase("K:\WorldTradeCenter\Newyork\iphone\Moto.mdb")
Set rs = db.openrecordset("select * from traffic")
End Sub

Private Sub Timer1_Timer()
Shape1.FillStyle = 0
Shape6.FillStyle = 0
Shape2.FillStyle = 1
Shape3.FillStyle = 1
Shape4.FillStyle = 1
Shape5.FillStyle = 1
Timer2.Enabled = True
Timer1.Enabled = False
Timer3.Enabled = False
Timer4.Enabled = False
Timer5.Enabled = True
End Sub

Private Sub Timer2_Timer()
Shape1.FillStyle = 1
Shape6.FillStyle = 1
Shape2.FillStyle = 0
Shape3.FillStyle = 1
Shape4.FillStyle = 1
Shape5.FillStyle = 0
Timer3.Enabled = True
Timer1.Enabled = False
Timer2.Enabled = False
Timer4.Enabled = False
Timer5.Enabled = True
End Sub

Private Sub Timer3_Timer()
Shape1.FillStyle = 1
Shape6.FillStyle = 1
Shape2.FillStyle = 1
Shape3.FillStyle = 0
Shape4.FillStyle = 0
Shape5.FillStyle = 1
Timer3.Enabled = False
Timer1.Enabled = False
Timer2.Enabled = False
Timer4.Enabled = True
Timer5.Enabled = True
End Sub

Private Sub Timer4_Timer()
Shape1.FillStyle = 1
Shape6.FillStyle = 1
Shape2.FillStyle = 0
Shape3.FillStyle = 1
Shape4.FillStyle = 1
Shape5.FillStyle = 0
Timer3.Enabled = False
Timer1.Enabled = True
Timer2.Enabled = False
Timer4.Enabled = False
Timer5.Enabled = True
End Sub

Private Sub Timer5_Timer()
If rs.EOF = False Then
Label2(0).Caption = rs(0)
Label2(1).Caption = rs(0)
rs.MoveNext
Else
rs.MoveFirst
End If
End Sub
 



To download the microsoft access database file click here
filename : Javabelazy32510
password : iphone6


Happy Onam to all visitors

http://javabelazy.blogspot.in/

No comments:

Post a Comment

Your feedback may help others !!!

Facebook comments