Hello,
Im a sophomore student working towards a CS degree and Im having problems with VB.net. Im working on an assignment to create a Vending Machine App. Ive got the whole thing ironed out but cant seem to animate the dropping of the can.
What Im trying to do is capture the location of a PictureBox and then make a another PictureBox move down 20 pixels every 100ms. The effect Im hoping for is a kinda-sorta animation of a can falling into to the bottom of the machine.
Im using this Sub as my pause:
Private Sub Wait(ByVal Time As Integer)
For X As Integer = 1 To Time
System.Threading.Thread.CurrentThread.Sleep(100)
Application.DoEvents()
Next
End Sub
This is the best trial I have had so far after several hours of trying code samples from the net:
Private Sub DropTheCan()
picCanDrop.Visible = True
Do While picCanDrop.Location.Y < 360
picCanDrop.Location = New Point(picCanDrop.Location.Y - 20)
Loop
End Sub
I get a flicker, albeit, in the wrong location.
Any help would be greatly appreciated.
Thank You.
Im a sophomore student working towards a CS degree and Im having problems with VB.net. Im working on an assignment to create a Vending Machine App. Ive got the whole thing ironed out but cant seem to animate the dropping of the can.
What Im trying to do is capture the location of a PictureBox and then make a another PictureBox move down 20 pixels every 100ms. The effect Im hoping for is a kinda-sorta animation of a can falling into to the bottom of the machine.
Im using this Sub as my pause:
Private Sub Wait(ByVal Time As Integer)
For X As Integer = 1 To Time
System.Threading.Thread.CurrentThread.Sleep(100)
Application.DoEvents()
Next
End Sub
This is the best trial I have had so far after several hours of trying code samples from the net:
Private Sub DropTheCan()
picCanDrop.Visible = True
Do While picCanDrop.Location.Y < 360
picCanDrop.Location = New Point(picCanDrop.Location.Y - 20)
Loop
End Sub
I get a flicker, albeit, in the wrong location.
Any help would be greatly appreciated.
Thank You.