Thursday, February 14, 2008

Chasing Snoopy Game code

Public Class Form1
Private myrandomnumber As New System.Random
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Randomize()
End Sub
Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
Label1.Text = (Integer.Parse(Label1.Text) + 1).ToString()
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
myrandomnumber.Next(100, 200)
PictureBox1.Location = New Point(myrandomnumber.Next(100, 200), myrandomnumber.Next(100, 200))
End Sub

End Class

No comments: