VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



How Lucky draw works (Random numbers)

by Fayyaz Butt (2 Submissions)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Wed 28th December 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)

How Lucky draw works (Random numbers)

API Declarations


' and a command button
' Please Feel Free to contact me for any idea u regarding programming needs
' email: [email protected]

Rate How Lucky draw works (Random numbers)



List1.Clear
Dim intRequiredSamples, intNum_Start, intNumEnd, intTempSample As Long
Dim intCounter As Integer
intCounter = 0
   intNum_Start = InputBox("Enter starting number", "Starting Number")
   intNum_End = InputBox("Enter Ending   number", "Ending Number")
   intRequiredSamples = InputBox("Enter Required samples", "Total Samples")
    
  Do
    intTempSample = Rnd() * intNum_End
    intTempSample = Int(intTempSample)
    If intTempSample >= intNum_Start And intTempSample <= intNum_End Then
        intCounter = intCounter + 1
        List1.AddItem intTempSample
    End If
    If intCounter >= intRequiredSamples Then
        Exit Do
    End If
  Loop
    
End Function


Private Sub Command1_Click()
 DrawNumber
End Sub


Download this snippet    Add to My Saved Code

How Lucky draw works (Random numbers) Comments

No comments have been posted about How Lucky draw works (Random numbers). Why not be the first to post a comment about How Lucky draw works (Random numbers).

Post your comment

Subject:
Message:
0/1000 characters