P: 6   |  This is a slot machine game, 2 forms. One is the actual game (frmMachine) and the other is in the background and randomizes the images shown on frmMachine. I need to make frmMachine wait for frmRandom, i tried it with the Sleep API and a Do/Until Loop and neither worked, could you please help me, I have my code below.  frmMachine -  'Slot Machine, (c) 2006 Peter Browne, GPL Licensed
 -  '
 -  'Peter Browne
 -  'Sheridan Corporate Centre
 -  '2155 Leanne Blvd., Ste. 200B
 -  'Mississauga ON L5K 2K8
 -  '(905) 616-6099
 -  'peterrbrowne@hotmail.com
 -  '
 -  '
 -  'PPPPPPPPPPPPPPPPPPPPPPPPP PPPPPPPPPPPPPPPPPPPPPPPPP BBBBBBBBBBBBBBBBBBBB
 -  ' PPPPPPPPPPPPPPPPPPPPPPPPPPP PPPPPPPPPPPPPPPPPPPPPPPPPP B BB
 -  ' PPPPPPPPP PP PPPPPPPPP PP B BB
 -  ' PPPPPPPPP PP PPPPPPPPP PP B BB
 -  ' PPPPPPPPP P PPPPPPPPP P B BB
 -  ' PPPPPPPPPPPPPPPPPPPPPPP PPPPPPPPPPPPPPPPPPPPPPPP B BB
 -  ' PPPPPPPPP PPPPPPPPPRRR B BB
 -  ' PPPPPPPPP PPPPPPPPP RRR B BB
 -  ' PPPPPPPPP PPPPPPPPP RRR B BB
 -  ' PPPPPPPPP PPPPPPPPP RRR BBBBBBBBBBBBBBBBBBB
 -  ' PPPPPPPPP PPPPPPPPP RRR BBBBBBBBBBBBBBBBBBB
 -  ' PPPPPPPPP PPPPPPPPP RRR B BB
 -  ' PPPPPPPPP PPPPPPPPP RRR B BB
 -  ' PPPPPPPPP PPPPPPPPP RRR B BB
 -  ' PPPPPPPPP PPPPPPPPP RRR B BB
 -  ' PPPPPPPPP PPPPPPPPP RRR B BB
 -  ' PPPPPPPPP PPPPPPPPP RRR B BB
 -  ' PPPPPPPPP PPPPPPPPP RRR B BB
 -  'PPPPPPPPPPP PPPPPPPPPPP RRR BBBBBBBBBBBBBBBBBBBB
 -  '
 -  ' GNU GENERAL PUBLIC LICENSE
 -  ' Version 2, June 1991
 -  '
 -  ' Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
 -  ' 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 -  ' Everyone is permitted to copy and distribute verbatim copies
 -  ' of this license document, but changing it is not allowed.
 -  '
 -  ' Preamble
 -  '
 -  ' The licenses for most software are designed to take away your
 -  'freedom to share and change it. By contrast, the GNU General Public
 -  'License is intended to guarantee your freedom to share and change free
 -  'software--to make sure the software is free for all its users. This
 -  'General Public License applies to most of the Free Software
 -  'Foundation 's software and to any other program whose authors commit to
 -  'using it. (Some other Free Software Foundation software is covered by
 -  'the GNU Lesser General Public License instead.) You can apply it to
 -  'your programs, too.
 -  '
 -  ' When we speak of free software, we are referring to freedom, not
 -  'price. Our General Public Licenses are designed to make sure that you
 -  'have the freedom to distribute copies of free software (and charge for
 -  'this service if you wish), that you receive source code or can get it
 -  'if you want it, that you can change the software or use pieces of it
 -  'in new free programs; and that you know you can do these things.
 -  '
 -  ' To protect your rights, we need to make restrictions that forbid
 -  'anyone to deny you these rights or to ask you to surrender the rights.
 -  'These restrictions translate to certain responsibilities for you if you
 -  'distribute copies of the software, or if you modify it.
 -  '
 -  ' For example, if you distribute copies of such a program, whether
 -  'gratis or for a fee, you must give the recipients all the rights that
 -  'you have. You must make sure that they, too, receive or can get the
 -  'source code. And you must show them these terms so they know their
 -  'rights.
 -  '
 -  ' We protect your rights with two steps: (1) copyright the software, and
 -  '(2) offer you this license which gives you legal permission to copy,
 -  'distribute and/or modify the software.
 -  '
 -  ' Also, for each author's protection and ours, we want to make certain
 -  'that everyone understands that there is no warranty for this free
 -  'software. If the software is modified by someone else and passed on, we
 -  'want its recipients to know that what they have is not the original, so
 -  'that any problems introduced by others will not reflect on the original
 -  'authors ' reputations.
 -  '
 -  ' Finally, any free program is threatened constantly by software
 -  'patents. We wish to avoid the danger that redistributors of a free
 -  'program will individually obtain patent licenses, in effect making the
 -  'program proprietary. To prevent this, we have made it clear that any
 -  'patent must be licensed for everyone's free use or not licensed at all.
 -  'Declares the variables
 -  Dim Bet As String 'Amount Bet
 -  Dim Amount As String 'Amount in Account
 -  Dim RandomImage As Integer 'Random Image
 -  Dim RandomCount As Integer 'Number of times random image is displayed
 -  Public One As Integer 'First Image
 -  Public Two As Integer 'Second Image
 -  Public Three As Integer 'Third image
 -  'Sleep
 -  Private Declare Sub Sleep Lib 'kernel32' (ByVal dwMilliseconds As Long)
 -  Private Sub Form_Load()
 -  'Sets the starting amount
 -  Amount = 250
 -  'Shows the starting amount
 -  lblAmount.Caption = 'You have: $' + Str(Amount)
 -  'Starts the music
 -  OLE1.DoVerb ' (Play)
 -  End Sub
 -  Private Sub cmdPull_Click()
 -  'Sets the bet as the input
 -  Bet = txtBet.Text
 -  'Checks to make sure that the bet is a number
 -  If Not IsNumeric(Bet) Then
 -  txtBet.Text = ' 'Clears the input
 -  MsgBox ('Please enter a dollar amount.') 'Displays the message box
 -  txtBet.SetFocus 'Sets the focus to be on the input
 -  Exit Sub 'Ends the program
 -  End If
 -  'Checks to make sure the bet is positive
 -  If Bet <= 0 Then
 -  txtBet.Text = ' 'Clears the input
 -  MsgBox ('You must enter $1 or more!') 'Displays the message box
 -  txtBet.SetFocus 'Sets the focus to be on the input
 -  Exit Sub 'Ends the program
 -  End If
 -  'Reduces the amount by the bet
 -  Amount = Amount - Bet
 -  lblAmount.Caption = 'You Have: $' + Str(Amount)
 -  'Checks if the user is trying to bankrupt themselves
 -  If Amount <= 0 Then
 -  Amount = Amount + Bet 'Raises the amount to the previous amount
 -  MsgBox ('You can't bet more then you have!') 'Displays the Message Box
 -  Exit Sub 'Ends the program
 -  End If
 -  'Calls frmRandom
 -  frmRandom.Show
 -  'Pauses for randomization
 -  Do Until frmRandom.RandomCount = 30
 -  Loop
 -  'Winner
 -  If One = Two And Two = Three Then 'Determines if user is a winner
 -  If One = 1 Then 'Sequence for vehicle is One
 -  Amount = Amount + 25 'Raises the amount by $25
 -  MsgBox ('You win $25!') 'Displays Message Box
 -  lblAmount.Caption = 'You Have: $' + Str(Amount)
 -  End If
 -  If One = 2 Then 'Sequence for vehicle is Two
 -  Amount = Amount + 30 'Raises the amount
 -  MsgBox ('You Win $30!') 'Displays Message Box
 -  lblAmount.Caption = 'You Have: $' + Str(Amount)
 -  End If
 -  If One = 3 Then 'Sequence for vehicle is Three
 -  Amount = Amount + 20 'Raises the amount
 -  MsgBox ('You Win $20') 'Diplays Message Box
 -  lblAmount.Caption = 'You Have: $' + Str(Amount)
 -  End If
 -  If One = 4 Then 'Sequence for vehicle is Four
 -  Amount = Amount - 35 'Lowers the Amount
 -  If Amount <= 0 Then 'Sequence for bankrupt users
 -  Amount = 0
 -  MsgBox ('You went bankrupt! I will now close!')
 -  lblAmount.Caption = 'You Have: $' + Str(Amount)
 -  Unload frmMachine
 -  Exit Sub
 -  End If
 -  MsgBox ('You Lost $35!')
 -  lblAmount.Caption = 'You Have: $' + Str(Amount)
 -  End If
 -  Else 'If user did not win
 -  MsgBox ('You did not win!')
 -  MsgBox ('Please try again!')
 -  End If
 -  End Sub
 -  Private Sub cmdDone_Click()
 -  'Closes the program
 -  Unload frmMachine
 -  End Sub
 
  |  
  |