Form1.vb

 Public Class Form1
    Inherits System.Windows.Forms.Form
    Dim MyTime As New TimeSpan()
    Dim A As Integer
    Dim count As Integer
    Dim f1, f2, f3, f4, f5 As Boolean
    Dim MyImg, MyImg2, MyImg3, MyImg4 As Object
#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer. 
    'Do not modify it using the code editor.
    Friend WithEvents Timer1 As System.Timers.Timer
    Friend WithEvents lbl1 As System.Windows.Forms.Label
    Friend WithEvents Timer2 As System.Timers.Timer
    Friend WithEvents BtStart As System.Windows.Forms.Button
    Friend WithEvents Bt1 As System.Windows.Forms.Button
    Friend WithEvents Bt2 As System.Windows.Forms.Button
    Friend WithEvents Bt3 As System.Windows.Forms.Button
    Friend WithEvents Bt4 As System.Windows.Forms.Button
    Friend WithEvents Bt5 As System.Windows.Forms.Button
    Friend WithEvents LblCount As System.Windows.Forms.Label
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Cbo1 As System.Windows.Forms.ComboBox
    Friend WithEvents Label2 As System.Windows.Forms.Label
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))
        Me.Timer1 = New System.Timers.Timer()
        Me.BtStart = New System.Windows.Forms.Button()
        Me.lbl1 = New System.Windows.Forms.Label()
        Me.Bt1 = New System.Windows.Forms.Button()
        Me.Bt2 = New System.Windows.Forms.Button()
        Me.Bt3 = New System.Windows.Forms.Button()
        Me.Bt4 = New System.Windows.Forms.Button()
        Me.Bt5 = New System.Windows.Forms.Button()
        Me.Timer2 = New System.Timers.Timer()
        Me.LblCount = New System.Windows.Forms.Label()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.Cbo1 = New System.Windows.Forms.ComboBox()
        Me.Label2 = New System.Windows.Forms.Label()
        CType(Me.Timer1, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.Timer2, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'Timer1
        '
        Me.Timer1.Interval = 1000
        Me.Timer1.SynchronizingObject = Me
        '
        'BtStart
        '
        Me.BtStart.Anchor = System.Windows.Forms.AnchorStyles.Top
        Me.BtStart.BackColor = System.Drawing.SystemColors.ActiveCaptionText
        Me.BtStart.ForeColor = System.Drawing.Color.Black
        Me.BtStart.ImageAlign = System.Drawing.ContentAlignment.BottomCenter
        Me.BtStart.Location = New System.Drawing.Point(240, 8)
        Me.BtStart.Name = "BtStart"
        Me.BtStart.Size = New System.Drawing.Size(56, 40)
        Me.BtStart.TabIndex = 1
        Me.BtStart.Text = "Start"
        Me.BtStart.TextAlign = System.Drawing.ContentAlignment.TopCenter
        '
        'lbl1
        '
        Me.lbl1.AutoSize = True
        Me.lbl1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.lbl1.Font = New System.Drawing.Font("Microsoft Sans Serif", 15.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.lbl1.Location = New System.Drawing.Point(328, 19)
        Me.lbl1.Name = "lbl1"
        Me.lbl1.Size = New System.Drawing.Size(0, 26)
        Me.lbl1.TabIndex = 3
        Me.lbl1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
        '
        'Bt1
        '
        Me.Bt1.Image = CType(resources.GetObject("Bt1.Image"), System.Drawing.Bitmap)
        Me.Bt1.Location = New System.Drawing.Point(120, 144)
        Me.Bt1.Name = "Bt1"
        Me.Bt1.Size = New System.Drawing.Size(40, 32)
        Me.Bt1.TabIndex = 4
        Me.Bt1.TextAlign = System.Drawing.ContentAlignment.BottomLeft
        Me.Bt1.Visible = False
        '
        'Bt2
        '
        Me.Bt2.Image = CType(resources.GetObject("Bt2.Image"), System.Drawing.Bitmap)
        Me.Bt2.Location = New System.Drawing.Point(120, 184)
        Me.Bt2.Name = "Bt2"
        Me.Bt2.Size = New System.Drawing.Size(40, 32)
        Me.Bt2.TabIndex = 5
        Me.Bt2.Visible = False
        '
        'Bt3
        '
        Me.Bt3.Image = CType(resources.GetObject("Bt3.Image"), System.Drawing.Bitmap)
        Me.Bt3.Location = New System.Drawing.Point(120, 232)
        Me.Bt3.Name = "Bt3"
        Me.Bt3.Size = New System.Drawing.Size(40, 32)
        Me.Bt3.TabIndex = 6
        Me.Bt3.Visible = False
        '
        'Bt4
        '
        Me.Bt4.Image = CType(resources.GetObject("Bt4.Image"), System.Drawing.Bitmap)
        Me.Bt4.Location = New System.Drawing.Point(240, 144)
        Me.Bt4.Name = "Bt4"
        Me.Bt4.Size = New System.Drawing.Size(40, 32)
        Me.Bt4.TabIndex = 7
        Me.Bt4.Visible = False
        '
        'Bt5
        '
        Me.Bt5.Image = CType(resources.GetObject("Bt5.Image"), System.Drawing.Bitmap)
        Me.Bt5.Location = New System.Drawing.Point(240, 192)
        Me.Bt5.Name = "Bt5"
        Me.Bt5.Size = New System.Drawing.Size(40, 32)
        Me.Bt5.TabIndex = 8
        Me.Bt5.Visible = False
        '
        'Timer2
        '
        Me.Timer2.Enabled = True
        Me.Timer2.Interval = 1000
        Me.Timer2.SynchronizingObject = Me
        '
        'LblCount
        '
        Me.LblCount.Font = New System.Drawing.Font("Verdana", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.LblCount.Location = New System.Drawing.Point(536, 8)
        Me.LblCount.Name = "LblCount"
        Me.LblCount.TabIndex = 10
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.Font = New System.Drawing.Font("Verdana", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label1.Location = New System.Drawing.Point(467, 8)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(55, 20)
        Me.Label1.TabIndex = 11
        Me.Label1.Text = "Hits: "
        '
        'Cbo1
        '
        Me.Cbo1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
        Me.Cbo1.Location = New System.Drawing.Point(104, 8)
        Me.Cbo1.Name = "Cbo1"
        Me.Cbo1.Size = New System.Drawing.Size(121, 21)
        Me.Cbo1.TabIndex = 12
        '
        'Label2
        '
        Me.Label2.AutoSize = True
        Me.Label2.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label2.Location = New System.Drawing.Point(16, 12)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(73, 14)
        Me.Label2.TabIndex = 13
        Me.Label2.Text = "Game Level"
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(692, 466)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Label2, Me.Cbo1, Me.Label1, Me.LblCount, Me.Bt5, Me.Bt4, Me.Bt3, Me.Bt2, Me.Bt1, Me.lbl1, Me.BtStart})
        Me.MaximizeBox = False
        Me.Name = "Form1"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "Game"
        CType(Me.Timer1, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.Timer2, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Intialize()
        Timer1.Stop()
        Timer2.Stop()
        BtStart.Image = Image.FromFile("..\49_49.gif")
        Cbo1.Items.Add("Beggner")
        Cbo1.Items.Add("Intermediat")
        Cbo1.Items.Add("Expert")
        MyImg = Image.FromFile("..\cry_smile.gif")
        MyImg2 = Image.FromFile("..\regular_smile.gif")
        MyImg3 = Image.FromFile("..\49_49.gif")
        MyImg4 = Image.FromFile("..\shades_smile.gif")
        'MyImg = Image.FromFile("D:\AsadKhan\Game\shades_smile.gif")
        'MyImg2 = Image.FromFile("D:\AsadKhan\Game\regular_smile.gif")
        'MyImg3 = Image.FromFile("D:\AsadKhan\Game\49_49.gif")
        'MyImg4 = Image.FromFile("D:\AsadKhan\Game\shades_smile.gif")

    End Sub

    Private Sub Timer1_Elapsed(ByVal sender As System.Object, ByVal e As System.Timers.ElapsedEventArgs) Handles Timer1.Elapsed
        MyTime = MyTime.Subtract(New TimeSpan(0, 0, 1))
        lbl1.Text = MyTime.ToString
    End Sub

    Private Sub BtStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtStart.Click
        Intialize()
        Timer1.Start()
        Timer2.Start()
    End Sub

    Public Sub Intialize()
        count = 0
        LblCount.Text = count
        f1 = False
        f2 = False
        f3 = False
        f4 = False
        f5 = False

        MyTime = New TimeSpan(0, 0, 30)
        lbl1.Text = MyTime.ToString
        Bt1.Image = MyImg2
        Bt2.Image = MyImg2
        Bt3.Image = MyImg2
        Bt4.Image = MyImg2
        Bt5.Image = MyImg2

        BtStart.Image = MyImg3

    End Sub

    Private Sub Timer2_Elapsed(ByVal sender As System.Object, ByVal e As System.Timers.ElapsedEventArgs) Handles Timer2.Elapsed
        GameStart()
    End Sub
    Private Sub GameStart()

        If MyTime.Seconds <= 0 Then
            Timer1.Stop()
            Timer2.Stop()
            BtStart.Text = "Start"
            BtStart.Image = Image.FromFile("..\52_52.gif")
            MsgBox("Game Over")
        ElseIf count = 5 Then
            Timer1.Stop()
            Timer2.Stop()
            BtStart.Image = MyImg4
            MsgBox("You Won")
            BtStart.Text = "Start"

        Else
            If A = 0 Then
                If f1 = False Then
                    Bt1.Visible = True
                    Bt1.Left = CInt(Int((550 * Rnd()) + 1)) ' Rnd() * 600
                    Bt1.Top = CInt(Int((500 * Rnd()) + 1)) 'Rnd() * 500 - 20
                End If

                If f2 = False Then
                    Bt2.Visible = True
                    Bt2.Left = CInt(Int((550 * Rnd()) + 1)) 'Rnd() * 600
                    Bt2.Top = CInt(Int((500 * Rnd()) + 1)) 'Rnd() * 500 - 20
                End If

                If f3 = False Then
                    Bt3.Visible = True
                    Bt3.Left = CInt(Int((550 * Rnd()) + 1)) ' Rnd() * 600
                    Bt3.Top = CInt(Int((500 * Rnd()) + 1)) 'Rnd() * 500 - 20
                End If

                If f4 = False Then
                    Bt4.Visible = True
                    Bt4.Left = CInt(Int((550 * Rnd()) + 1)) ' Rnd() * 600
                    Bt4.Top = CInt(Int((500 * Rnd()) + 1)) 'Rnd() * 500 - 20
                End If

                If f5 = False Then
                    Bt5.Visible = True
                    Bt5.Left = CInt(Int((550 * Rnd()) + 1)) 'Rnd() * 600
                    Bt5.Top = CInt(Int((500 * Rnd()) + 1)) 'Rnd() * 500 - 20
                End If
                A = 1
            Else
                If f1 = False Then
                    Bt1.Visible = False
                End If
                If f2 = False Then
                    Bt2.Visible = False
                End If
                If f3 = False Then
                    Bt3.Visible = False
                End If
                If f4 = False Then
                    Bt4.Visible = False
                End If
                If f5 = False Then
                    Bt5.Visible = False
                End If
                A = 0
            End If
        End If
    End Sub
    Private Sub Bt1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bt1.Click
        Bt1.Image = MyImg
        f1 = True
        count += 1
        LblCount.Text = count
    End Sub

    Private Sub Bt2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bt2.Click
        Bt2.Image = MyImg
        f2 = True
        count += 1
        LblCount.Text = count
    End Sub

    Private Sub Bt3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bt3.Click
        Bt3.Image = MyImg
        f3 = True
        count += 1
        LblCount.Text = count
    End Sub

    Private Sub Bt4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bt4.Click
        Bt4.Image = MyImg
        f4 = True
        count += 1
        LblCount.Text = count
    End Sub

    Private Sub Bt5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bt5.Click
        Bt5.Image = MyImg
        f5 = True
        count += 1
        LblCount.Text = count
    End Sub

    Private Sub Cbo1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cbo1.SelectedIndexChanged
        If (Cbo1.SelectedIndex) = 1 Then
            Timer2.Interval = 500
        ElseIf (Cbo1.SelectedIndex) = 2 Then
            Timer2.Interval = 200
        Else
            Timer2.Interval = 1000
        End If
    End Sub

    Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click

    End Sub
End Class

Project Homepage: