Fix a crash until cause is found, slightly change position of UI element
parent
626b57c982
commit
0c5c9e115b
|
@ -225,7 +225,7 @@ Partial Class Form1
|
||||||
'
|
'
|
||||||
WinMessage.AutoSize = True
|
WinMessage.AutoSize = True
|
||||||
WinMessage.Font = New Font("Segoe UI", 15.75F, FontStyle.Regular, GraphicsUnit.Point)
|
WinMessage.Font = New Font("Segoe UI", 15.75F, FontStyle.Regular, GraphicsUnit.Point)
|
||||||
WinMessage.Location = New Point(565, 221)
|
WinMessage.Location = New Point(535, 216)
|
||||||
WinMessage.Name = "WinMessage"
|
WinMessage.Name = "WinMessage"
|
||||||
WinMessage.Size = New Size(0, 30)
|
WinMessage.Size = New Size(0, 30)
|
||||||
WinMessage.TabIndex = 15
|
WinMessage.TabIndex = 15
|
||||||
|
|
|
@ -73,7 +73,14 @@
|
||||||
deck.RemoveAt(0)
|
deck.RemoveAt(0)
|
||||||
GetTotal(player)
|
GetTotal(player)
|
||||||
Dim cardNumber As String = If(isDealer, (player.hand.count + 5).ToString(), player.hand.count)
|
Dim cardNumber As String = If(isDealer, (player.hand.count + 5).ToString(), player.hand.count)
|
||||||
Dim pictureBox As PictureBox = CType(Me.Controls.Find("PlayerCard" + cardNumber, True).First(), PictureBox)
|
Dim pictureBox As PictureBox
|
||||||
|
Try
|
||||||
|
pictureBox = CType(Me.Controls.Find("PlayerCard" + cardNumber, True).First(), PictureBox)
|
||||||
|
Catch ex As Exception
|
||||||
|
WinMessage.Text = "Error: " + ex.Message
|
||||||
|
EndGame()
|
||||||
|
End Try
|
||||||
|
|
||||||
pictureBox.Image = GetCardImage(card)
|
pictureBox.Image = GetCardImage(card)
|
||||||
SetTotalLabels()
|
SetTotalLabels()
|
||||||
End Sub
|
End Sub
|
||||||
|
@ -151,10 +158,12 @@
|
||||||
End Sub
|
End Sub
|
||||||
Sub CheckGame()
|
Sub CheckGame()
|
||||||
WinMessage.Text = GetResults()
|
WinMessage.Text = GetResults()
|
||||||
|
EndGame()
|
||||||
|
End Sub
|
||||||
|
Sub EndGame()
|
||||||
HitButton.Enabled = False
|
HitButton.Enabled = False
|
||||||
StandButton.Enabled = False
|
StandButton.Enabled = False
|
||||||
StartGame.Enabled = True
|
StartGame.Enabled = True
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
Function GetResults()
|
Function GetResults()
|
||||||
If dealer.winType = WinCondition.Blackjack Then
|
If dealer.winType = WinCondition.Blackjack Then
|
||||||
|
|
Loading…
Reference in New Issue