Results 1 to 5 of 5

Thread: random unique images

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    random unique images

    Hello everyone,
    I am looking for help.... I would like to generate automaticly 15 random and unique Pictures for Image...
    so far I have this code, It can eveń overwrite some Images but not the one which was correct before the wrong one... I feel i Need Little push up...

    Private Sub CommandButton1_Click()
    Dim x As Integer
    Dim counter As Integer
    Dim priznak(1 To 15) As Integer
    counter = 1
    Randomize
    x = Int(15 * Rnd) + 1
    For i = 1 To 15
        If i = 1 Then
            Me("Image" & i).Picture = LoadPicture("V:\CGC_DATA\Images\picture" & x & ".jpg")
            Me("Image" & i).Tag = x
            priznak(i) = x
        ElseIf i > 1 Then
            Me("Image" & i).Picture = LoadPicture("V:\CGC_DATA\Images\picture" & x & ".jpg")
            Me("Image" & i).Tag = x
            priznak(i) = x
            For j = 1 To i - 1
            If priznak(j) = priznak(i) Then
                MsgBox "Already exist"
            End If
                Do While priznak(j) = priznak(i)
                x = Int(15 * Rnd) + 1
                Me("Image" & i).Picture = LoadPicture("V:\CGC_DATA\Images\picture" & x & ".jpg")
                Me("Image" & i).Tag = x
                priznak(i) = x
                Loop
            Next
        End If
        x = Int(15 * Rnd) + 1
    Next
    End Sub
    everyones help would be welcome
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •