does anyone knows how to make randomizing frames appear only once...

because i'm using randomized questions, with the use of frames for my games., but my questions appear more than once...can you help me about this?...

9 Years
Discussion Span
Last Post by jonc

You could use an array to hold the previous questions displayed, and validate the new random number against the contents of that array before showing it?
It may make it run slower, but at least it will only show once.


what's the code on how can i hold the previous questions using array,. i tried to disable it but, all frames did not appear..pls help

Private intCounter As Integer
Private intQuestion As Integer   'This is the random number from your existing code

Private Sub NewQuestion()
'-- Your source code so far but when you go to display the new question,
   'Call the CheckQuestion function to ensure the question is not in the array.
    If CheckQuestion(intQuestion) = False Then
        '-- Make the question frame visible
        '-- Generate a new random number and check again
    End If
End Sub

Private Function CheckQuestion(RandomNumber as Integer) as Boolean
    '-- Check against an array using the counter to go through each 'cell' of the array
       'and if the random number is not found, continue to the next one. Continue until end.
       'if random number is not found, return true so the question can be displayed.
    '-- If the random number is found then return false so a new number can be generated.
End Function

intQuestion is the question number that you created in your existing code - the random number. I've included it here just for the purpose of clarity.

Apologies about the lack of an array code... they're not my strong point so I daren't embarrass myself!! (I'm still learning), but the theory is there.
Hopefully someone a bit cleverer than me on VB will help me out :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.