Dim NumBalls% 'declare the need variables
Dim Winners%(1 To 6)
Dim Title As String
Sub PredictNumbers()
Dim inum%, n%, Temp%
Randomize
ReDim Balls%(1 To 49)
Dim LoopCheck%, NoSwap%
Timer2.Enabled = False 'disabled the timer
For n = 0 To 5 'reset all labels and back colours
Label2(n).Caption = ""
Shape1(n).BackColor = &HC0C0C0
Next n
For n = 1 To 49: Balls%(n) = n: Next n 'set the 49 balls
For n = 1 To 6
LoopCheck = 0
Do
inum = Int(49 * Rnd + 1)
Loop Until (Balls%(inum) > 0) Or (LoopCheck > 99)
Balls%(inum) = 0
Winners%(n) = inum
Next n
Do
NoSwap = True
For n = 1 To 5
If Winners%(n + 1) < Winners%(n) Then
Temp = Winners%(n + 1)
Winners%(n + 1) = Winners%(n)
Winners%(n) = Temp
NoSwap = False
End If
Next n
Loop Until NoSwap%
Timer2.Enabled = True 'enable the timer
NumBalls = 1
Title = String(30, " ") + "Your chossen lotter numbers for this have been picked GOOD LUCK!" 'scroll this message
End Sub
Private Sub Cancel_Click()
Unload Me 'exit the program
End Sub
Private Sub Form_Load()
Move (Screen.Width - Width) \ 2, (Screen.Height - Height) \ 2 'centre the form on the screen
Title = String(50, " ") + "Lottery Predictor" 'scroll this messageEnd Sub
Private Sub Predict_Click()
Call PredictNumbers 'predict the numbers
End Sub
Private Sub Timer1_Timer()
Title = Mid(Title, 2) & Left(Title, 1)
Lottery.Caption = Title
End Sub
Private Sub timer2_Timer()
Dim BNum%, BCol&
If NumBalls > 6 Then Exit Sub
BNum = Winners%(NumBalls)
If BNum < 10 Then BCol = &HFFFFFF
If BNum >= 10 And BNum < 20 Then BCol = &HFF8080
If BNum >= 20 And BNum < 30 Then BCol = &H8080FF
If BNum >= 30 And BNum < 40 Then BCol = &HFF00&
If BNum >= 40 Then BCol = &HFFFF&