You are on page 1of 3

GUI Application Development Using VB.

NET

----------------------------------------------------------
Name :- Ashish Arvind Khillare Roll No :- 31

Class :- CO4I Enrollment No :- 2000690208

----------------------------------------------------------
Program For A Traffic Light

Code :-

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles


MyBase.Load
Timer1.Enabled = True
Timer2.Enabled = False

End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles


Timer1.Tick

TextBox1.BackColor = Color.Red
TextBox2.BackColor = Color.White
TextBox3.BackColor = Color.White

Timer1.Enabled = False
Timer2.Enabled = True
Timer3.Enabled = False

End Sub

Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles


Timer2.Tick
TextBox1.BackColor = Color.White
TextBox2.BackColor = Color.Yellow
TextBox3.BackColor = Color.White
Timer1.Enabled = False
Timer2.Enabled = False
Timer3.Enabled = True

End Sub

Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles


Timer3.Tick
TextBox1.BackColor = Color.White
TextBox2.BackColor = Color.White
TextBox3.BackColor = Color.Green

Timer1.Enabled = True
Timer2.Enabled = False
Timer3.Enabled = False

End Sub
End Class

Output :-

You might also like