title: Blackjack: Won't add Dealer's Hand
body: <p>I have a problem with my blackjack game in vb.net. This code I have will add the player's score perfectly, but when it comes to the dealer's score, it will not. It only takes the second card that the dealer has.</p>
  
  <p>It is called with this:</p>
  
  <pre><code>addScore("p")   'add player's score
  addScore("d")   'add dealer's score
  </code></pre>
  
  <p>And this is "addScore()":</p>
  
  <pre><code>Public Function card(player As String, index As Integer) As Label
      Try
          If player = "p" Then
              Return GroupBox1.Controls.OfType(Of Label).Where(Function(l) l.Name = "YouCard" &amp; index.ToString()).Single()
          ElseIf player = "d" Then
              Return GroupBox1.Controls.OfType(Of Label).Where(Function(l) l.Name = "DealerCard" &amp; index.ToString()).Single()
          End If
      Catch
          Return Nothing
      End Try
  End Function
  
  Public Sub addScore(ByVal player As String)
      Dim currScore As Integer
      Dim result As Integer = 0
      'Add Score
      For value As Integer = 1 To 7
          If card(player, value).Text = "A" AndAlso (currScore + 11) &lt;= 21 Then
              result = currScore + 11
          ElseIf card(player, value).Text = "A" AndAlso (currScore + 1) &lt;= 22 Then
              result = currScore + 1
          ElseIf IsNumeric(card(player, value).Text) Then
              result = currScore + CInt(card(player, value).Text)
          ElseIf card(player, value).Text = "" Then
              result = result
          Else
              result = currScore + 10
          End If
          If player = "p" Then
              YouScore.Text = result
          Else
              DealerScore.Text = result
          End If
      Next
  End Sub
  </code></pre>