Private Sub MenDeal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenDeal.Click Dim Myhand() As String = New String(5) {} Dim myHandNumeric() As Integer = {0, 0, 0, 0, 0} Dim ValueMatches() As Integer = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} Dim suitMatches() As Integer = {0, 0, 0, 0} Dim Suits As String() = New String() {"Hearts", "Diamonds", "Clubs", "Spades"} Dim Faces As String() = New String() {"Ace", "Deuce", "Three", _ "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King"} Dim Deck As Integer() = New Integer(51) {} Dim cnt As Integer = 0 Dim Random As Random = New Random lblHand.Text = "" lblResult.Text = "" While cnt < 5 Randomize() Dim cardnum As Integer cardnum = Random.Next(0, 51) If (Deck(cardnum) = 0) Then ' my card will be cardnum Deck(cardnum) = 1 Myhand(cnt) = Faces((cardnum Mod 13)) & " of " & Suits((cardnum \ 13)) lblHand.Text += Myhand(cnt) & ControlChars.CrLf ValueMatches(cardnum \ 13) += 1 suitMatches(CType(Math.Floor(cardnum / 13), Integer)) += 1 cnt += 1 End If End While Dim nPairs As Integer = 0 Dim nThreeKind As Integer = 0 Dim nFourKind As Integer = 0 For Each value As Integer In ValueMatches Select Case value Case 2 nPairs += 1 Case 3 nThreeKind += 1 Case 4 nFourKind += 1 End Select Next With Me.lblResult Dim Flag As Boolean If (nPairs > 0) Then .Text += String.Format("You have {0} pair", nPairs) If (nThreeKind > 0) Then .Text += "You have a three-of-a-kinds" If (nFourKind > 0) Then .Text += "You have a four-of-a-kind" End With End Sub