Hi there. I have a problem in randomly falling an object. I want my program to randomly fall an image and I only have 1 image fall. The code I've used for falling an object is here.

Inline Code Example Here

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Me.PictureBox1.Top += 20
    End Sub

That's because you are only affecting one PictureBox in the timer. If you have multiple pictureboxes you could either generate a random number and use that in a Select Case to pick a random image, or you could create an array of references to the pictureboxes and use the random number as an index into that array.

If I have a 5 images. Thus that 5 images will fall multiple times in form?

That depends on whether or not you adjust the Top property for an image. If you do then it falls. If you don't then it doesn't.

ahh. I don't know how to applyit. Can you show me some codes that will random images?

If we have

Dim rnd As New Random

then we can generate a random number from 1 to 5 by


Don't ask why you have to specify 6 when you want a number from 1 to 5. That's just Microsoft's mindless idiocy at work. If you have previously set up

Private pics() As PictureBox = {PictureBox1,PictureBox2,PictureBox3, _

then in your timer event you can do

Dim num As Integer = rnd.Next(0,5)
pics(num).Top += 5

'do something here if the picture is off the screen

ok. THAnk your very much. =))