If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Visual Basic > Help

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old
Registered User
 
Join Date: Dec 2012
Posts: 2
Red face Help

If anyone can help me with this blackjack program it would be greatly appreciated. I'm having trouble making the message box show, and if there are any other errors please tell me how to fix them

Option Explicit
Private intcomp, intplayer, intplayer2, intcounter As Integer

Private Sub cmddone_Click()
Unload frm9
End Sub

Private Sub cmddraw_Click()
intcounter = intcounter + 1


If intcounter = 1 Then
lblcard6 = (Int((10 - 1 + 1) * Rnd + 1))
End If

If intcounter = 2 Then
lblcard7 = (Int((10 - 1 + 1) * Rnd + 1))
End If

If intcounter = 3 Then
lblcard8 = (Int((10 - 1 + 1) * Rnd + 1))
End If

If intcounter = 4 Then
lblcard9 = (Int((10 - 1 + 1) * Rnd + 1))
End If
End Sub

Private Sub cmdscore_Click()
lblcard3.Visible = True
lblcard4.Visible = True
lblcard5.Visible = True

intcomp = lblcard3 + lblcard4 + lblcard5
intplayer = lblcard + lblcard2

If intcounter = 0 Then
intplayer = lblcard + lblcard2
If intcomp = intplayer Then
MsgBox "You tie"
ElseIf intcomp > intplayer And intcomp < 22 Then
MsgBox "You lose"
ElseIf intplayer > intcomp And intplayer < 22 Then
MsgBox "You win."
End If
End If

If intcounter = 1 Then
intplayer2 = intplayer + lblcard6
End If
If intcomp > intplayer2 And intcomp < 2 Then
MsgBox "You lose."
ElseIf intplayer2 = intcomp Then
MsgBox "You tie."
ElseIf intplayer2 > intcomp And intplayer2 < 22 Then
MsgBox "You win."
End If

If intcounter = 2 Then
intplayer2 = intplayer + lblcard6 + lblcard7
End If
If intcomp > intplayer2 And intcomp < 2 Then
MsgBox "You lose."
ElseIf intplayer2 = intcomp Then
MsgBox "You tie."
ElseIf intplayer2 > intcomp And intplayer2 < 22 Then
MsgBox "You win."
End If

If intcounter = 3 Then
intplayer2 = intplayer + lblcard6 + lblcard7 + lblcard8
End If
If intcomp > intplayer2 And intcomp < 2 Then
MsgBox "You lose."
ElseIf intplayer2 = intcomp Then
MsgBox "You tie."
ElseIf intplayer2 > intcomp And intplayer2 < 22 Then
MsgBox "You win."
End If

If intcounter = 4 Then
intplayer2 = intplayer + lblcard6 + lblcard7 + lblcard8 + lblcard9
End If
If intcomp > intplayer2 And intcomp < 2 Then
MsgBox "You lose."
ElseIf intplayer2 = intcomp Then
MsgBox "You tie."
ElseIf intplayer2 > intcomp And intplayer2 < 22 Then
MsgBox "You win."
End If
End Sub

Private Sub Form_Load()
Randomize

lblcard = (Int((10 - 1 + 1) * Rnd + 1))
lblcard2 = (Int((10 - 1 + 1) * Rnd + 1))
lblcard3 = (Int((10 - 1 + 1) * Rnd + 1))
lblcard4 = (Int((10 - 1 + 1) * Rnd + 1))
lblcard5 = (Int((10 - 1 + 1) * Rnd + 1))

intcounter = 0


lblcard3.Visible = False
lblcard4.Visible = False
lblcard5.Visible = False

End Sub
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On