I am almost finished making a black jack game and I was wondering how to solve this problem i have tried everything i know and it is all unsuccessful... I will copy and paste my code and show the problem
see text below the code...


Public Class Form1
Public YourCards As Integer = 0
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim TheRandomClass As New Random
Dim i As Integer = 0
Dim p As Integer = 10
i = TheRandomClass.Next(1, 14)
Label3.Text = i.ToString
YourCards += i
Label2.Text = "Your Cards: " + YourCards.ToString
If YourCards > 21 Then
MessageBox.Show("You Went Over")
YourCards = 0
Label3.Text = ""
Label2.Text = "Your Cards: 0"
Label4.Text = ""
End If
If YourCards = 21 Then
MessageBox.Show("You Won")
YourCards = 0
Label3.Text = ""
Label2.Text = "Your Cards: 0"
Label4.Text = ""
End If
If Label3.Text = "1" Then
Label4.Text = "A"
End If
If Label3.Text = "2" Then
Label4.Text = "2"
End If
If Label3.Text = "3" Then
Label4.Text = "3"
End If
If Label3.Text = "4" Then
Label4.Text = "4"
End If
If Label3.Text = "5" Then
Label4.Text = "5"
End If
If Label3.Text = "6" Then
Label4.Text = "6"
End If
If Label3.Text = "7" Then
Label4.Text = "7"
End If
If Label3.Text = "8" Then
Label4.Text = "8"
End If
If Label3.Text = "9" Then
Label4.Text = "9"
End If
If Label3.Text = "10" Then
Label4.Text = "10"
End If
If Label3.Text = "11" Then
Label4.Text = "A"
End If
If Label3.Text = "12" Then
Label4.Text = "J"
If Label3.Text = "12" Then
YourCards = +10
End If
End If
If Label3.Text = "13" Then
Label4.Text = "Q"
If Label3.Text = "13" Then
YourCards = +10
End If
End If
If Label3.Text = "14" Then
Label4.Text = "K"
If Label3.Text = "14" Then
YourCards = +10
End If
End If
End Sub


Right above there are the lines of code that say If Label3.Text = "14" Then
YourCards = +10
If Label3.Text = "13" Then
YourCards = +10
If Label3.Text = "12" Then
YourCards = +10
I would like the value of jack queen and king to equal ten but if i do that throgh label3.text = 10 then make it randomized through 10 jack queen and king it makes face cards show up 4 times as less........
i have tried everything
yourcards+= 10
i += 10
Yourcards + p....
i = 10
etc i tried just about everything

Don't use YourCards += i, or else you'll add 1-14. The simplest way to do this would simply be to check before adding with an if statement. Something like:

if i >= 10
YourCards += 10
Else
YourCards += i;
End If
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.