-
i am currently working a game. i draw out imageboxes named "imgControl" (using index property) in a form.
my problem is how can i generate random picked pictures that are stored in a folder and display them in the imgControl during run-time? (by the way the random pictures must be picked up twice) e.g: picA picA, picD, picD.
-
How about adding them all to a ListBox, then randomly selecting a ListIndex from the listbox will result in randomly selecting a Picture.
Code:
Randomize
Num = Int(Rnd * List1.ListCount)
imgControl = LoadPicture(App.Path & "\" & List1.List(Num)
-
i only wanted the pictures stored in a folder, how can i random pick them from folder?
-
Name them in an arithmetic sequence (e.g. {im1, im2, im3, ...}) and
Code:
Randomize
Num = Int(Rnd * Number of Images you have)
imgControl = LoadPicture(App.path & "Im" & Num & ".gif")
Replace Im and .gif with whatever name/extension you gave the images.
[Comment - Megatron: You need to get VB6]