I was given a task of creating a lucky draw program.
1.Total numbers of accounts are 00001 to 99999.
2.But only 131 accounts will be chosen.
3.3 sections - 1 account for 1 car, 20 accounts for 20 iPhone, 10 accounts for 10 Samsung 4.Galaxy & 100 accounts for $100 Voucher.
5.Use randomize.
6.Use sorting - ascending order.
I did manage to create the program, but I don't know how to sort the numbers according to their section.
Did I do incorrectly? Or do I need to add/edit something?
Private Sub Command1_Click()
Dim arrayno(1 To 131)
Dim luckyno
Dim counter
Dim check
For counter = 1 To 131
start:
Randomize
luckyno = Int((99999 * Rnd) + 1)
For check = 1 To 131
If luckyno = arrayno(check) Then
GoTo start
End If
Next check
arrayno(counter) = luckyno
Text1(counter - 1) = arrayno(counter)
Next counter
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim i As Integer
For i = 1 To 130
Text1(i).Text = ""
Next i
End Sub