Dim X As Integer
Dim n As Integer
Dim Bet As Currency 'General Declarations Section
Dim SubTotal As Currency
Dim Game As Integer 'All that follows is code for #1 button:
Dim SharkMoney As Currency
Dim SharkCount As Integer
Dim Out As Integer
Dim Times As Integer
Private Sub Cmd1_Click()
Select Case Game
Case 0: MsgBox "Place your Bet" 'message user forgot to bet
Case 1:
If SharkCount > 3 Then
Image1.Picture = LoadPicture("C:\dukish.jpg")
lblMessage = "You need to get the money"
Out = MsgBox("The LoanShark is coming to visit you", vbCritical, "Out Of Luck")
End
End If
Loanshark = MsgBox("Want Money from the LoanShark?", vbYesNo, "Out of Money")
Image1.Picture = LoadPicture("C:\vb\dukish.jpg")
lblMessage = "You got the Loan"
If Loanshark = 6 Then
ListBox1.AddItem "You borrowed a C-Note"
SharkMoney = SharkMoney + 100
SharkCount = SharkCount + 1
If SharkCount > 2 Then
ListBox1.AddItem "You owe $" & Str(SharkMoney) & " and better pay it back!"
End If
SubTotal = SubTotal + 100 'When user runs out of money, yes/no box pops up
txtMoney.Text = "$ " & SubTotal
Game = 2 'Yes gives user a hundred dollars
Else
MsgBox "Game Over"
End 'No ends game
End If
Case 2: 'If all is well, the game plays:
Randomize Timer
n = Int(Rnd * 6) + 1 'Produces a random number 1 to 6 for winning number
If 1 = n Then 'number picked
Randomize Timer
Times = Int(Rnd * 5) + 2 'Produces a random number 2 to 6 for times bet
txtMessage.Text = "Number " & n & " Winner" 'If random number matches button number
Image1.Picture = LoadPicture("C:\vb\Happy.jpg") 'good things happen:
lblMessage = "You Won " & Times & " X Your Bet" 'For image and sound, need to have files on C
WindowsMediaPlayer1.URL = "C:\vb\chimes.Wav" 'drive with matching names
SubTotal = SubTotal + Times * Bet
txtMoney.Text = "$ " & SubTotal
cmd1.Caption = "Winner"
Else
txtMessage.Text = "It was " & n 'If random number isn't a match
Image1.Picture = LoadPicture("C:\vb\Sad.jpg") 'bad things happen:
lblMessage = "You Lose"
WindowsMediaPlayer1.URL = "C:\vb\Chord.Wav"
SubTotal = SubTotal - Bet
txtMoney.Text = "$ " & SubTotal
cmd1.Caption = "1"
End If
End Select
If SubTotal <= 0 Then
Game = 1
End If
End Sub
Private Sub Cmd2_Click()
Select Case Game
Case 0: MsgBox "Place your Bet" 'message user forgot to bet
Case 1:
If SharkCount > 3 Then
Image1.Picture = LoadPicture("C:\vb\dukish.jpg")
lblMessage = "You got the Loan"
Out = MsgBox("The LoanShark is coming to visit you", vbCritical, "Out Of Luck")
End
End If
Loanshark = MsgBox("Want Money from the LoanShark?", vbYesNo, "Out of Money")
Image1.Picture = LoadPicture("C:\vb\dukish.jpg")
lblMessage = "You got the Loan"
If Loanshark = 6 Then
ListBox1.AddItem "You borrowed a C-Note"
SharkMoney = SharkMoney + 100
SharkCount = SharkCount + 1
If SharkCount > 2 Then
ListBox1.AddItem "You owe $" & Str(SharkMoney) & " and better pay it back!"
End If
SubTotal = SubTotal + 100 'When user runs out of money, yes/no box pops up
txtMoney.Text = "$ " & SubTotal
Game = 2 'Yes gives user a hundred dollars
Else
MsgBox "Game Over"
End 'No ends game
End If
Case 2: 'If all is well, the game plays:
Randomize Timer
n = Int(Rnd * 6) + 1 'Produces a random number 1 to 6 for winning number
If 2 = n Then 'number picked
Randomize Timer
Times = Int(Rnd * 5) + 2 'Produces a random number 2 to 6 for times bet
txtMessage.Text = "Yes, number " & n & " Winner" 'If random number matches button number
Image1.Picture = LoadPicture("C:\vb\Happy.jpg") 'good things happen:
lblMessage = "You Won " & Times & " X Your Bet" 'For image and sound, need to have files on C
WindowsMediaPlayer1.URL = "C:\vb\chimes.Wav" 'drive with matching names
SubTotal = SubTotal + Times * Bet
txtMoney.Text = "$ " & SubTotal
cmd2.Caption = "Winner"
Else
txtMessage.Text = "It was " & n 'If random number isn't a match
Image1.Picture = LoadPicture("C:\vb\Sad.jpg") 'bad things happen:
lblMessage = "You Lose"
WindowsMediaPlayer1.URL = "C:\vb\Chord.Wav"
SubTotal = SubTotal - Bet
txtMoney.Text = "$ " & SubTotal
cmd2.Caption = "2"
End If
End Select
If SubTotal <= 0 Then
Game = 1
End If
End Sub
Private Sub Cmd3_Click()
Select Case Game
Case 0: MsgBox "Place your Bet" 'message user forgot to bet
Case 1:
If SharkCount > 3 Then
Image1.Picture = LoadPicture("C:\vb\dukish.jpg")
lblMessage = "You got the Loan"
Out = MsgBox("The LoanShark is coming to visit you", vbCritical, "Out Of Luck")
End
End If
Loanshark = MsgBox("Want Money from the LoanShark?", vbYesNo, "Out of Money")
Image1.Picture = LoadPicture("C:\vb\dukish.jpg")
lblMessage = "You got the Loan"
If Loanshark = 6 Then
ListBox1.AddItem "You borrowed a C-Note"
SharkMoney = SharkMoney + 100
SharkCount = SharkCount + 1
If SharkCount > 2 Then
ListBox1.AddItem "You owe $" & Str(SharkMoney) & " and better pay it back!"
End If
SubTotal = SubTotal + 100 'When user runs out of money, yes/no box pops up
txtMoney.Text = "$ " & SubTotal
Game = 2 'Yes gives user a hundred dollars
Else
MsgBox "Game Over"
End 'No ends game
End If
Case 2: 'If all is well, the game plays:
Randomize Timer
n = Int(Rnd * 6) + 1 'Produces a random number 1 to 6for winning number
If 3 = n Then 'The number was picked
Randomize Timer
Times = Int(Rnd * 5) + 2 'Produces a random number 2 to 6 for times bet
If 2 > Times Then
Times = 2 ' assures bet gets at least doubled
End If
txtMessage.Text = "Number " & n & " Winner" 'If random number matches button number
Image1.Picture = LoadPicture("C:\vb\Happy.jpg") 'good things happen:
lblMessage = "You Got Back " & Times & " X Your Bet" 'For image and sound, need to have files on C
WindowsMediaPlayer1.URL = "C:\vb\chimes.Wav" 'drive with matching names
SubTotal = SubTotal + Times * Bet
txtMoney.Text = "$ " & SubTotal
cmd3.Caption = "Winner"
Else
txtMessage.Text = "It was " & n 'If random number isn't a match
Image1.Picture = LoadPicture("C:\vb\Sad.jpg") 'bad things happen:
lblMessage = "You Lose"
WindowsMediaPlayer1.URL = "C:\vb\Chord.Wav"
SubTotal = SubTotal - Bet
txtMoney.Text = "$ " & SubTotal
cmd3.Caption = "3"
End If
End Select
If SubTotal <= 0 Then
Game = 1
End If
End Sub
Private Sub Cmd4_Click()
Select Case Game
Case 0: MsgBox "Place your Bet" 'message user forgot to bet
Case 1:
If SharkCount > 3 Then
Image1.Picture = LoadPicture("C:\vb\dukish.jpg")
lblMessage = "You got the Loan"
Out = MsgBox("The LoanShark is coming to visit you", vbCritical, "Out Of Luck")
End
End If
Loanshark = MsgBox("Want Money from the LoanShark?", vbYesNo, "Out of Money")
Image1.Picture = LoadPicture("C:\vb\dukish.jpg")
lblMessage = "You got the Loan"
If Loanshark = 6 Then
ListBox1.AddItem "You borrowed a C-Note"
SharkMoney = SharkMoney + 100
SharkCount = SharkCount + 1
If SharkCount > 2 Then
ListBox1.AddItem "You owe $" & Str(SharkMoney) & " and better pay it back!"
End If
SubTotal = SubTotal + 100 'When user runs out of money, yes/no box pops up
txtMoney.Text = "$ " & SubTotal
Game = 2 'Yes gives user a hundred dollars
Else
MsgBox "Game Over"
End 'No ends game
End If
Case 2: 'If all is well, the game plays:
Randomize Timer
n = Int(Rnd * 6) + 1 'Produces a random number 1 to 6 for winning number
If 4 = n Then 'number picked
Randomize Timer
Times = Int(Rnd * 5) + 2 'Produces a random number 2 to 6 for times bet
txtMessage.Text = n & " is a Winner" 'If random number matches button number
Image1.Picture = LoadPicture("C:\vb\Happy.jpg") 'good things happen:
lblMessage = "Winner of " & Times & " X Your Bet" 'For image and sound, need to have files on C
WindowsMediaPlayer1.URL = "C:\vb\chimes.Wav" 'drive with matching names
SubTotal = SubTotal + Times * Bet
txtMoney.Text = "$ " & SubTotal
cmd4.Caption = "Winner"
Else
txtMessage.Text = "It was " & n 'If random number isn't a match
Image1.Picture = LoadPicture("C:\vb\Sad.jpg") 'bad things happen:
lblMessage = "You Lose"
WindowsMediaPlayer1.URL = "C:\vb\Chord.Wav"
SubTotal = SubTotal - Bet
txtMoney.Text = "$ " & SubTotal
cmd4.Caption = "4"
End If
End Select
If SubTotal <= 0 Then
Game = 1
End If
End Sub
Private Sub Cmd5_Click()
Select Case Game
Case 0: MsgBox "Place your Bet" 'message user forgot to bet
Case 1:
If SharkCount > 3 Then
Image1.Picture = LoadPicture("C:\vb\dukish.jpg")
lblMessage = "You got the Loan"
Out = MsgBox("The LoanShark is coming to visit you", vbCritical, "Out Of Luck")
End
End If
Loanshark = MsgBox("Want Money from the LoanShark?", vbYesNo, "Out of Money")
Image1.Picture = LoadPicture("C:\vb\dukish.jpg")
lblMessage = "You got the Loan"
If Loanshark = 6 Then
ListBox1.AddItem "You borrowed a C-Note"
SharkMoney = SharkMoney + 100
SharkCount = SharkCount + 1
If SharkCount > 2 Then
ListBox1.AddItem "You owe $" & Str(SharkMoney) & " and better pay it back!"
End If
SubTotal = SubTotal + 100 'When user runs out of money, yes/no box pops up
txtMoney.Text = "$ " & SubTotal
Game = 2 'Yes gives user a hundred dollars
Else
MsgBox "Game Over"
End 'No ends game
End If
Case 2: 'If all is well, the game plays:
Randomize Timer
n = Int(Rnd * 6) + 1 'Produces a random number 1 to 6 for winning number
If 5 = n Then 'number picked
Randomize Timer
Times = Int(Rnd * 5) + 2 'Produces a random number 2 to 6 for times bet
txtMessage.Text = "Yes " & n & " is a Winner" 'If random number matches button number
Image1.Picture = LoadPicture("C:\vb\Happy.jpg") 'good things happen:
lblMessage = "Winner of " & Times & " X Your Bet" 'For image and sound, need to have files on C
WindowsMediaPlayer1.URL = "C:\vb\chimes.Wav" 'drive with matching names
SubTotal = SubTotal + Times * Bet
txtMoney.Text = "$ " & SubTotal
cmd5.Caption = "Winner"
Else
txtMessage.Text = "It was " & n 'If random number isn't a match
Image1.Picture = LoadPicture("C:\vb\Sad.jpg") 'bad things happen:
lblMessage = "You Lose"
WindowsMediaPlayer1.URL = "C:\vb\Chord.Wav"
SubTotal = SubTotal - Bet
txtMoney.Text = "$ " & SubTotal
cmd5.Caption = "5"
End If
End Select
If SubTotal <= 0 Then
Game = 1
End If
End Sub
Private Sub Cmd6_Click()
Select Case Game
Case 0: MsgBox "Place your Bet" 'message user forgot to bet
Case 1:
If SharkCount > 3 Then
Image1.Picture = LoadPicture("C:\vb\dukish.jpg")
lblMessage = "You got the Loan"
Out = MsgBox("The LoanShark is coming to visit you", vbCritical, "Out Of Luck")
End
End If
Loanshark = MsgBox("Want Money from the LoanShark?", vbYesNo, "Out of Money")
Image1.Picture = LoadPicture("C:\vb\dukish.jpg")
lblMessage = "You got the Loan"
If Loanshark = 6 Then
ListBox1.AddItem "You borrowed a C-Note"
SharkMoney = SharkMoney + 100
SharkCount = SharkCount + 1
If SharkCount > 2 Then
ListBox1.AddItem "You owe $" & Str(SharkMoney) & " and better pay it back!"
End If
SubTotal = SubTotal + 100 'When user runs out of money, yes/no box pops up
txtMoney.Text = "$ " & SubTotal
Game = 2 'Yes gives user a hundred dollars
Else
MsgBox "Game Over"
End 'No ends game
End If
Case 2: 'If all is well, the game plays:
Randomize Timer
n = Int(Rnd * 6) + 1 'Produces a random number 1 to 6 for winning number
If 6 = n Then 'number picked
Randomize Timer
Times = Int(Rnd * 5) + 2 'Produces a random number 2 to 6 for times bet
txtMessage.Text = "Yes " & n & " is a Winner" 'If random number matches button number
Image1.Picture = LoadPicture("C:\vb\Happy.jpg") 'good things happen:
lblMessage = "Winner of " & Times & " X Your Bet" 'For image and sound, need to have files on C
WindowsMediaPlayer1.URL = "C:\vb\chimes.Wav" 'drive with matching names
SubTotal = SubTotal + Times * Bet
txtMessage.Text = "$ " & SubTotal
cmd6.Caption = "Winner"
Else
txtMessage.Text = "It was " & n 'If random number isn't a match
Image1.Picture = LoadPicture("C:\vb\Sad.jpg") 'bad things happen:
lblMessage = "You Lose"
WindowsMediaPlayer1.URL = "C:\vb\Chord.Wav"
SubTotal = SubTotal - Bet
txtMoney.Text = "$ " & SubTotal
cmd6.Caption = "6"
End If
End Select
If SubTotal <= 0 Then
Game = 1
End If
End Sub
Private Sub Opt5_Click()
Bet = 5 'allows game to play
Game = 2
End Sub
Private Sub Opt10_Click()
Bet = 10 'allows game to play
Game = 2
End Sub
Private Sub Opt20_Click()
Bet = 20 'allows game to play
Game = 2
End Sub
Private Sub cmdAbout_Click()
MsgBox "The game starts with $100, and you can borrow money from a Loanshark. You can win up to 6 times your bet."
End Sub
Private Sub CmdExit_Click()
MsgBox "Your Cash Out is $" & SubTotal
End
End Sub
Private Sub UserForm_Initialize()
txtMessage.Text = "Place your Bet, to Win."
SubTotal = 100
txtMoney.Text = "$ " & SubTotal 'Shows the $100 in the textbox
ListBox1.AddItem "Game starts, you have $100"
End Sub