# How to setup a Timer Function

**URL:** <https://forums.thehomestack.io/t/how-to-setup-a-timer-function/226>\
**Category:** vb.Net\
**Created:** [September 18, 2005, 2:53pm UTC](https://forums.thehomestack.io/t/how-to-setup-a-timer-function/226 "2005-09-18T14:53:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://forums.thehomestack.io/uploads/default/original/1X/161426793bc0d8bdf0d1a6692b3e44446861cc72.jpeg) [@system](https://forums.thehomestack.io/u/system)\
**Post date:** [September 18, 2005, 2:53pm UTC](https://forums.thehomestack.io/t/how-to-setup-a-timer-function/226/1 "2005-09-18T14:53:27Z")

</div>

```auto

' At the top of your form:
Dim PicCounter As Integer = 0

' In a button click event:
 Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Timer1.Enabled = True
        Timer1.Interval = 1000
    End Sub

' In the Timer's Tick event:
 Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick

        PicCounter += 1 ' Inc the counter
       
      ' Show next picbox, depending on where we are in the sequence:
        Select Case PicCounter
            Case 1
                PictureBox1.Visible = True
                PictureBox3.Visible = False
                Timer1.Interval = 1000 '<-- This will make PictureBox1 Visable for 1 sec
            Case 2
                PictureBox2.Visible = True
                PictureBox1.Visible = False
                Timer1.Interval = 2000 '<-- This will make PictureBox2 Visable for 2 sec
            Case 3
                PictureBox3.Visible = True
                PictureBox2.Visible = False
                PicCounter = 0
                Timer1.Interval = 500 '<-- This will make PictureBox3 Visable for 1/2 sec
        End Select
    End Sub

```
