title: asp.net C# Poker game
body: <p>Hello I am working on a poker game that is on my website designed in asp.net.  As of right now, I have a lot working properly such as: when I hit a pair, 3 of a kind, flush, 4 of a king, and royal flush.  The computer knows when those are hit.  I am having trouble with getting it to understand when I have a two pair, which it just counts it as one pair.  I have tried a few different ways.
  Here is a copy of my code</p>
  
  <pre><code>string[] PokerCard = new String[5];
  
              PokerCard[0] = PokerCard1.ImageUrl = Path.Combine("~/GameStyles/VideoPoker/Images/BackCards/BackCard1.png");
              PokerCard[1] = PokerCard2.ImageUrl = Path.Combine("~/GameStyles/VideoPoker/Images/BackCards/BackCard2.png");
              PokerCard[2] = PokerCard3.ImageUrl = Path.Combine("~/GameStyles/VideoPoker/Images/BackCards/BackCard3.png");
              PokerCard[3] = PokerCard4.ImageUrl = Path.Combine("~/GameStyles/VideoPoker/Images/BackCards/BackCard4.png");
              PokerCard[4] = PokerCard5.ImageUrl = Path.Combine("~/GameStyles/VideoPoker/Images/BackCards/BackCard5.png");    
  
    public void Pair()
      {
          for (int i = 0; i &lt; 4; i++)
          {
              for (int k = 0; k &lt; 5; k++)
              {
                  if (PokerCard[k] == two[i])
                  {
                      PokerTwo++;
                  }
                  if (PokerTwo == 2)
                  {
                      cash = cash + 10;
                      winnings = winnings + 10;
                      Cash.Text = Convert.ToString(cash);
                      Winnings.Text = Convert.ToString(winnings);
                      PairWin.BackColor = Color.Red;
                      Winner.Visible = true;
                      return;
                  }
                  if (PokerCard[k] == three[i])
                  {
                      PokerThree++;
                  }
                  if (PokerThree == 2)
                  {
                      cash = cash + 10;
                      winnings = winnings + 10;
                      Cash.Text = Convert.ToString(cash);
                      Winnings.Text = Convert.ToString(winnings);
                      PairWin.BackColor = Color.Red;
                      Winner.Visible = true;
                      return;
                  }
                  if (PokerCard[k] == four[i])
                  {
                      PokerFour++;
                  }
                  if (PokerFour == 2)
                  {
                      cash = cash + 10;
                      winnings = winnings + 10;
                      Cash.Text = Convert.ToString(cash);
                      Winnings.Text = Convert.ToString(winnings);
                      PairWin.BackColor = Color.Red;
                      Winner.Visible = true;
                      return;
                  }
                  if (PokerCard[k] == five[i])
                  {
                      PokerFive++;
                  }
                  if (PokerFive == 2)
                  {
                      cash = cash + 10;
                      winnings = winnings + 10;
                      Cash.Text = Convert.ToString(cash);
                      Winnings.Text = Convert.ToString(winnings);
                      PairWin.BackColor = Color.Red;
                      Winner.Visible = true;
                      return;
                  }
                  if (PokerCard[k] == six[i])
                  {
                      PokerSix++;
                  }
                  if (PokerSix == 2)
                  {
                      cash = cash + 10;
                      winnings = winnings + 10;
                      Cash.Text = Convert.ToString(cash);
                      Winnings.Text = Convert.ToString(winnings);
                      PairWin.BackColor = Color.Red;
                      Winner.Visible = true;
                      return;
                  }
                  if (PokerCard[k] == seven[i])
                  {
                      PokerSeven++;
                  }
                  if (PokerSeven == 2)
                  {
                      cash = cash + 10;
                      winnings = winnings + 10;
                      Cash.Text = Convert.ToString(cash);
                      Winnings.Text = Convert.ToString(winnings);
                      PairWin.BackColor = Color.Red;
                      Winner.Visible = true;
                      return;
                  }
                  if (PokerCard[k] == eight[i])
                  {
                      PokerEight++;
                  }
                  if (PokerEight == 2)
                  {
                      cash = cash + 10;
                      winnings = winnings + 10;
                      Cash.Text = Convert.ToString(cash);
                      Winnings.Text = Convert.ToString(winnings);
                      PairWin.BackColor = Color.Red;
                      Winner.Visible = true;
                      return;
                  }
                  if (PokerCard[k] == nine[i])
                  {
                      PokerNine++;
                  }
                  if (PokerNine == 2)
                  {
                      cash = cash + 10;
                      winnings = winnings + 10;
                      Cash.Text = Convert.ToString(cash);
                      Winnings.Text = Convert.ToString(winnings);
                      PairWin.BackColor = Color.Red;
                      Winner.Visible = true;
                      return;
                  }
                  if (PokerCard[k] == ten[i])
                  {
                      PokerTen++;
                  }
                  if (PokerTen == 2)
                  {
                      cash = cash + 10;
                      winnings = winnings + 10;
                      Cash.Text = Convert.ToString(cash);
                      Winnings.Text = Convert.ToString(winnings);
                      PairWin.BackColor = Color.Red;
                      Winner.Visible = true;
                      return;
                  }
                  if (PokerCard[k] == jack[i])
                  {
                      PokerJack++;
                  }
                  if (PokerJack == 2)
                  {
                      cash = cash + 10;
                      winnings = winnings + 10;
                      Cash.Text = Convert.ToString(cash);
                      Winnings.Text = Convert.ToString(winnings);
                      PairWin.BackColor = Color.Red;
                      Winner.Visible = true;
                      return;
                  }
                  if (PokerCard[k] == queen[i])
                  {
                      PokerQueen++;
                  }
                  if (PokerQueen == 2)
                  {
                      cash = cash + 10;
                      winnings = winnings + 10;
                      Cash.Text = Convert.ToString(cash);
                      Winnings.Text = Convert.ToString(winnings);
                      PairWin.BackColor = Color.Red;
                      Winner.Visible = true;
                      return;
                  }
                  if (PokerCard[k] == king[i])
                  {
                      PokerKing++;
                  }
                  if (PokerKing == 2)
                  {
                      cash = cash + 10;
                      winnings = winnings + 10;
                      Cash.Text = Convert.ToString(cash);
                      Winnings.Text = Convert.ToString(winnings);
                      PairWin.BackColor = Color.Red;
                      Winner.Visible = true;
                      return;
                  }
                  if (PokerCard[k] == ace[i])
                  {
                      PokerAce++;
                  }
                  if (PokerAce == 2)
                  {
                      cash = cash + 10;
                      winnings = winnings + 10;
                      Cash.Text = Convert.ToString(cash);
                      Winnings.Text = Convert.ToString(winnings);
                      PairWin.BackColor = Color.Red;
                      Winner.Visible = true;
                      return;
                  }
              }
          }
      }
  </code></pre>
  
  <p>Just trying to get it understand when you have two pair in your hard rather than just one pair.  Thanks any help would be appreciated.</p>