|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Random image help
I am making an activity, where sheep pop out, from 1 to 100. They are all the same sheep and look the same now my question is:
I would like to know how to make a random amount of sheep pop up on the form. For example they click the start button and a random amount of sheep pop-up? They then must count how many sheep there are. How would I do that. I know its something to do with the int(rnd*100)+1 formula. So far I have a picture box, but when I press f5 i see the picture box and its not supposed to show until they press the start button to make random sheep. So please help. Thanks |
|
#2
|
|||
|
|||
|
It does not work. I currently have 4 pictures of sheep and they are conrol arrays, as well as a command button. So if you can fix this i would be very appreciative thanks!
Private Sub Command1_Click() numsheep = Int(Rnd * 4 - 1) + 1 For x = 0 To numsheep Sheep.Image(x) = thesheep.Image Next x End Sub |
|
#3
|
|||
|
|||
|
Change Sheep.Image(x) = thesheep.Image
to set Sheep.Image(x) = thesheep.Image.. |
|
#4
|
|||
|
|||
|
Isnt that the same thing?
|
|
#5
|
||||
|
||||
|
no.. at least not in VB6 (it is in VB.NET). in VB6 you use the "set" keyword to set the property of an object = to another object
__________________
Fisherman "Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." - A.Einstein |
|
#6
|
|||
|
|||
|
Classic explain!!
Thank u.. ![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > Random image help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|