Ok so i have been making a blackjack game in vb 2010 and am having troubles with getting the game to be played more than once without having to close and load the game up again.
This is the button "stay" which i have two of one for player 1 and another for player 2 each picture box represents a card that is randomly generated using a case. there are 10 cards 5 for each player and the first two for each player are loaded at form load (picture boxes 1,2 and 10, 9)
Code:
Private Sub btnhold1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnhold1.Click
PictureBox3.Enabled = False
PictureBox4.Enabled = False
PictureBox5.Enabled = False
btnhold1.Enabled = False
If btnhold1.Enabled = False And btnhold2.Enabled = False And total <= 21 And total > total2 Then
lblmoney1.Text = lblmoney1.Text + (bet1 * 2)
lbltotal.ResetText()
lbltotal2.ResetText()
total = 0
total2 = 0
ElseIf btnhold1.Enabled = False And btnhold2.Enabled = False And total2 <= 21 And total2 > total Then
lblmoney2.Text = lblmoney2.Text + (bet2 * 2)
lbltotal.ResetText()
lbltotal2.ResetText()
total = 0
total2 = 0
ElseIf btnhold1.Enabled = False And btnhold2.Enabled = False And total2 <= 21 And total2 = total Then
lblmoney2.Text = lblmoney2.Text + bet2
lblmoney1.Text = lblmoney1.Text + bet1
lbltotal.ResetText()
lbltotal2.ResetText()
total = 0
total2 = 0
If Label1.Visible = True Then
PictureBox3.Image = Nothing
PictureBox4.Image = Nothing
PictureBox5.Image = Nothing
PictureBox8.Image = Nothing
PictureBox7.Image = Nothing
PictureBox6.Image = Nothing
bet1 = 0
bet2 = 0
btnbet1.Enabled = True
btnbet2.Enabled = True
End If
End If
End Sub
I want to be able to pretty much reset the whole form after one of the players has won but i do not want the money that each player has or the username that they submitted at form load.
This is just a short idea of how my random card generator works.
Code:
Randomize()
x = Rnd() * 52 + 1
Select Case x
Case 1
PictureBox3.Image = Blackjack.My.Resources._2D
value = 2
Case 2
PictureBox3.Image = Blackjack.My.Resources._2H
value = 2
Case 3
PictureBox3.Image = Blackjack.My.Resources._2C
value = 2
Case 4
PictureBox3.Image = Blackjack.My.Resources._2S
value = 2
Any help would be much appreciated.