How can I add procedure to Timers that are created during runtime?
I want the timer that is created to control the movement of the newly created apple. Anyone know?Code:Public Function NewApple() Dim picNewApple As PictureBox = New PictureBox() Dim tmrNewApple As Timer = New Timer() Dim AppleType As Integer = RandomNumber(100) Select Case AppleType Case Is >= 50 picNewApple.Image = Image.FromFile(Application.StartupPath & "\RedApple.gif") Case Is >= 25 picNewApple.Image = Image.FromFile(Application.StartupPath & "\GreenApple.gif") Case Is >= 15 picNewApple.Image = Image.FromFile(Application.StartupPath & "\GoldApple.gif") Case Is >= 0 picNewApple.Image = Image.FromFile(Application.StartupPath & "\WormApple.gif") End Select picNewApple.SizeMode = PictureBoxSizeMode.AutoSize picNewApple.Location = New System.Drawing.Point(RandomNumber(600), -51) picNewApple.BackColor = System.Drawing.Color.Transparent picNewApple.SendToBack() Me.Controls.Add(picNewApple) End Function




Reply With Quote