Program to display traffic Signal using timer in VB.NET/Visual Basic

....


OvalShape Property :
FIllStyle:- Solid
FILLcolor:- Red FOR 1 , Yellow FOR 2,Green FOR 3

Timer Property :
Enabled:-True
Interval:-5000 miliSec

User Interface:





Code:


Public Class Form1


    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        If OvalShape1.Visible Then
            OvalShape1.Visible = False
            OvalShape2.Visible = True
            OvalShape3.Visible = False
        ElseIf OvalShape2.Visible Then
            OvalShape1.Visible = False
            OvalShape2.Visible = False
            OvalShape3.Visible = True
        ElseIf OvalShape3.Visible Then
            OvalShape1.Visible = True
            OvalShape2.Visible = False
            OvalShape3.Visible = False
        End If
    End Sub

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        OvalShape1.Visible = True
        OvalShape2.Visible = False
        OvalShape3.Visible = False
    End Sub
End Class


Output:





Comments