tomanderson12
Member
- Joined
- Jan 21, 2008
- Sythe Gold
- 0
- Messages
- 53
Hello guys, I have a problem I have a program that is the generate random numbers but not the same one again I thought I had it with this but all it does is display the same number again in the 6 text boxes i have which are all control arrays by the way
So basically when you click cmdRun it generates random numbers into 6 text boxes called txtMachine which are control arrays, but it doesn't generate random numbers in each its the same one for all the boxes
the code is
So basically when you click cmdRun it generates random numbers into 6 text boxes called txtMachine which are control arrays, but it doesn't generate random numbers in each its the same one for all the boxes
the code is
Code:
Private Sub cmdRun_Click()
' Dimension the variables used in the programme
Dim intNumber As Integer
Dim arrNumber(0 To 5) As Integer
Dim count As Integer
Dim i As Integer
Dim x As Integer
Dim y As Integer
'Sets Count
For x = 0 To 5
Randomize
intNumber = Int(Rnd * 49) + 1 ' Random number 1 to 49
For y = 0 To 5
' Check arrNumber (y)
'If intnumber has already been selected,
'Then go and select another one.
If intNumber = arrNumber(y) Then
End If
Next y
arrNumber(x) = intNumber
txtMachine(count).Text = (arrNumber(i))
count = i + 1
Next x
'----------------------------------------------------
For i = 0 To 5
Next
End Sub



