how can i make a random number not to always appear every time i open the program
my code always prints or present same number every time i open and terminate and open it again and again it always shows same number but if i click a button for random it does show random number
this code just my example:
note: this is just an example not my true code in my program...

Dim rndm As Integer
    rndm = Int(4 * Rnd())
    Select Case rndm
    Case 1
        list1.additem = 1
    Case 2
        list1.additem= 2
    Case 3
        list1.additem = 3
    Case 4
        list1.additem = 4
    End Select
8 Years
Discussion Span
Last Post by AndreRet

Your problem is that the random number is not saved to your system, hence the same number every time it starts. Save the random number to your registry and let the app select a random number from this number. Google "Save number to registry in VB6", plenty of samples to choose from.

You can also save this number to a database, call it from there and then call for a random number.

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.