Link to home
Start Free TrialLog in
Avatar of John Gates, CISSP, CDPSE
John Gates, CISSP, CDPSEFlag for United States of America

asked on

Easiest way to generate a 6 digit random number

Looking for the easiest way to do this in vb6, thanks 8)
ASKER CERTIFIED SOLUTION
Avatar of frankd
frankd
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of John Gates, CISSP, CDPSE

ASKER

I did some other things as the same numbers kept coming up in order...

Private Sub Command1_Click()
Dim k As Variant
Dim l As Variant
Dim dRandNumFull As Variant
Dim dRandNumDisplay As Variant
Dim i As Variant


For i = 1 To 1000

           Randomize (rnd)
             
            k = Date * Time * 10
                         
           dRandNumFull = Format(Int(k * rnd), "000000")
           
           dRandNumDisplay = dRandNumFull
           
          'MsgBox dRandNumDisplay
           
         Text1.Text = Text1.Text & dRandNumDisplay & vbCrLf

Next
         
           
End Sub

This gave the desired result!
Thanks for your help!!