Public Class Form1 Dim c1, c2, c3, c4, c5 As Integer Dim pairs As Integer Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click pairs = 0 reroll: ' Randomize() c1 = Int(Rnd() * 52) + 1 c2 = Int(Rnd() * 52) + 1 c3 = Int(Rnd() * 52) + 1 c4 = Int(Rnd() * 52) + 1 c5 = Int(Rnd() * 52) + 1 'If any of the numbers (c1 to c5) are same, get new numbers If c4 = c5 Or c1 = c2 Or c1 = c3 Or c1 = c4 Or c1 = c5 Or c2 = c3 Or c2 = c4 Or c2 = c5 Or c3 = c4 Or c3 = c5 Then GoTo reroll End If dealCard1() dealCard2() dealCard3() dealCard4() dealCard5() checkPairs() showResults() End Sub Public Sub showResults() If pairs = 0 Then Label1.Text = "High card" End If If pairs = 1 Then Label1.Text = "Pair" End If If pairs = 2 Then Label1.Text = "Two Pairs" End If 'Add 3 of Kind, Full House, 4 of Kind 'Flush and Straight are extra credit End Sub Public Sub checkPairs() If c1 Mod 13 = c2 Mod 13 Then pairs = pairs + 1 End If If c1 Mod 13 = c3 Mod 13 Then pairs = pairs + 1 End If 'Add 8 more ifs for the other possible combinations End Sub Public Sub dealCard1() If c1 = 1 Then card1.Image = Image.FromFile("ac.png") ElseIf c1 = 2 Then card1.Image = Image.FromFile("2c.png") ElseIf c1 = 3 Then card1.Image = Image.FromFile("3c.png") ElseIf c1 = 4 Then card1.Image = Image.FromFile("4c.png") ElseIf c1 = 5 Then card1.Image = Image.FromFile("5c.png") ElseIf c1 = 6 Then card1.Image = Image.FromFile("6c.png") ElseIf c1 = 7 Then card1.Image = Image.FromFile("7c.png") ElseIf c1 = 8 Then card1.Image = Image.FromFile("8c.png") ElseIf c1 = 9 Then card1.Image = Image.FromFile("9c.png") ElseIf c1 = 10 Then card1.Image = Image.FromFile("10c.png") ElseIf c1 = 11 Then card1.Image = Image.FromFile("jc.png") ElseIf c1 = 12 Then card1.Image = Image.FromFile("qc.png") ElseIf c1 = 13 Then card1.Image = Image.FromFile("kc.png") 'Diamonds Start (14 to 26) ElseIf c1 = 14 Then card1.Image = Image.FromFile("ad.png") ElseIf c1 = 15 Then card1.Image = Image.FromFile("2d.png") ElseIf c1 = 16 Then card1.Image = Image.FromFile("3d.png") ElseIf c1 = 17 Then card1.Image = Image.FromFile("4d.png") ElseIf c1 = 18 Then card1.Image = Image.FromFile("5d.png") ElseIf c1 = 19 Then card1.Image = Image.FromFile("6d.png") ElseIf c1 = 20 Then card1.Image = Image.FromFile("7d.png") ElseIf c1 = 21 Then card1.Image = Image.FromFile("8d.png") ElseIf c1 = 22 Then card1.Image = Image.FromFile("9d.png") ElseIf c1 = 23 Then card1.Image = Image.FromFile("10d.png") ElseIf c1 = 24 Then card1.Image = Image.FromFile("jd.png") ElseIf c1 = 25 Then card1.Image = Image.FromFile("qd.png") ElseIf c1 = 26 Then card1.Image = Image.FromFile("kd.png") '27 to 39 is Hearts ElseIf c1 = 27 Then card1.Image = Image.FromFile("ah.png") ElseIf c1 = 28 Then card1.Image = Image.FromFile("2h.png") ElseIf c1 = 29 Then card1.Image = Image.FromFile("3h.png") ElseIf c1 = 30 Then card1.Image = Image.FromFile("4h.png") ElseIf c1 = 31 Then card1.Image = Image.FromFile("5h.png") ElseIf c1 = 32 Then card1.Image = Image.FromFile("6h.png") ElseIf c1 = 33 Then card1.Image = Image.FromFile("7h.png") ElseIf c1 = 34 Then card1.Image = Image.FromFile("8h.png") ElseIf c1 = 35 Then card1.Image = Image.FromFile("9h.png") ElseIf c1 = 36 Then card1.Image = Image.FromFile("10h.png") ElseIf c1 = 37 Then card1.Image = Image.FromFile("jh.png") ElseIf c1 = 38 Then card1.Image = Image.FromFile("qh.png") ElseIf c1 = 39 Then card1.Image = Image.FromFile("kh.png") ' 40 to 52 are spades ElseIf c1 = 40 Then card1.Image = Image.FromFile("as.png") ElseIf c1 = 41 Then card1.Image = Image.FromFile("2s.png") ElseIf c1 = 42 Then card1.Image = Image.FromFile("3s.png") ElseIf c1 = 43 Then card1.Image = Image.FromFile("4s.png") ElseIf c1 = 44 Then card1.Image = Image.FromFile("5s.png") ElseIf c1 = 45 Then card1.Image = Image.FromFile("6s.png") ElseIf c1 = 46 Then card1.Image = Image.FromFile("7s.png") ElseIf c1 = 47 Then card1.Image = Image.FromFile("8s.png") ElseIf c1 = 48 Then card1.Image = Image.FromFile("9s.png") ElseIf c1 = 49 Then card1.Image = Image.FromFile("10s.png") ElseIf c1 = 50 Then card1.Image = Image.FromFile("js.png") ElseIf c1 = 51 Then card1.Image = Image.FromFile("qs.png") ElseIf c1 = 52 Then card1.Image = Image.FromFile("ks.png") End If End Sub Public Sub dealCard2() If c2 = 1 Then card2.Image = Image.FromFile("ac.png") ElseIf c2 = 2 Then card2.Image = Image.FromFile("2c.png") ElseIf c2 = 3 Then card2.Image = Image.FromFile("3c.png") ElseIf c2 = 4 Then card2.Image = Image.FromFile("4c.png") ElseIf c2 = 5 Then card2.Image = Image.FromFile("5c.png") ElseIf c2 = 6 Then card2.Image = Image.FromFile("6c.png") ElseIf c2 = 7 Then card2.Image = Image.FromFile("7c.png") ElseIf c2 = 8 Then card2.Image = Image.FromFile("8c.png") ElseIf c2 = 9 Then card2.Image = Image.FromFile("9c.png") ElseIf c2 = 10 Then card2.Image = Image.FromFile("10c.png") ElseIf c2 = 11 Then card2.Image = Image.FromFile("jc.png") ElseIf c2 = 12 Then card2.Image = Image.FromFile("qc.png") ElseIf c2 = 13 Then card2.Image = Image.FromFile("kc.png") 'Diamonds Start (14 to 26) ElseIf c2 = 14 Then card2.Image = Image.FromFile("ad.png") ElseIf c2 = 15 Then card2.Image = Image.FromFile("2d.png") ElseIf c2 = 16 Then card2.Image = Image.FromFile("3d.png") ElseIf c2 = 17 Then card2.Image = Image.FromFile("4d.png") ElseIf c2 = 18 Then card2.Image = Image.FromFile("5d.png") ElseIf c2 = 19 Then card2.Image = Image.FromFile("6d.png") ElseIf c2 = 20 Then card2.Image = Image.FromFile("7d.png") ElseIf c2 = 21 Then card2.Image = Image.FromFile("8d.png") ElseIf c2 = 22 Then card2.Image = Image.FromFile("9d.png") ElseIf c2 = 23 Then card2.Image = Image.FromFile("10d.png") ElseIf c2 = 24 Then card2.Image = Image.FromFile("jd.png") ElseIf c2 = 25 Then card2.Image = Image.FromFile("qd.png") ElseIf c2 = 26 Then card2.Image = Image.FromFile("kd.png") '27 to 39 is Hearts ElseIf c2 = 27 Then card2.Image = Image.FromFile("ah.png") ElseIf c2 = 28 Then card2.Image = Image.FromFile("2h.png") ElseIf c2 = 29 Then card2.Image = Image.FromFile("3h.png") ElseIf c2 = 30 Then card2.Image = Image.FromFile("4h.png") ElseIf c2 = 31 Then card2.Image = Image.FromFile("5h.png") ElseIf c2 = 32 Then card2.Image = Image.FromFile("6h.png") ElseIf c2 = 33 Then card2.Image = Image.FromFile("7h.png") ElseIf c2 = 34 Then card2.Image = Image.FromFile("8h.png") ElseIf c2 = 35 Then card2.Image = Image.FromFile("9h.png") ElseIf c2 = 36 Then card2.Image = Image.FromFile("10h.png") ElseIf c2 = 37 Then card2.Image = Image.FromFile("jh.png") ElseIf c2 = 38 Then card2.Image = Image.FromFile("qh.png") ElseIf c2 = 39 Then card2.Image = Image.FromFile("kh.png") ' 40 to 52 are spades ElseIf c2 = 40 Then card2.Image = Image.FromFile("as.png") ElseIf c2 = 41 Then card2.Image = Image.FromFile("2s.png") ElseIf c2 = 42 Then card2.Image = Image.FromFile("3s.png") ElseIf c2 = 43 Then card2.Image = Image.FromFile("4s.png") ElseIf c2 = 44 Then card2.Image = Image.FromFile("5s.png") ElseIf c2 = 45 Then card2.Image = Image.FromFile("6s.png") ElseIf c2 = 46 Then card2.Image = Image.FromFile("7s.png") ElseIf c2 = 47 Then card2.Image = Image.FromFile("8s.png") ElseIf c2 = 48 Then card2.Image = Image.FromFile("9s.png") ElseIf c2 = 49 Then card2.Image = Image.FromFile("10s.png") ElseIf c2 = 50 Then card2.Image = Image.FromFile("js.png") ElseIf c2 = 51 Then card2.Image = Image.FromFile("qs.png") ElseIf c2 = 52 Then card2.Image = Image.FromFile("ks.png") End If End Sub Public Sub dealcard3() If c3 = 1 Then card3.Image = Image.FromFile("ac.png") ElseIf c3 = 2 Then card3.Image = Image.FromFile("2c.png") ElseIf c3 = 3 Then card3.Image = Image.FromFile("3c.png") ElseIf c3 = 4 Then card3.Image = Image.FromFile("4c.png") ElseIf c3 = 5 Then card3.Image = Image.FromFile("5c.png") ElseIf c3 = 6 Then card3.Image = Image.FromFile("6c.png") ElseIf c3 = 7 Then card3.Image = Image.FromFile("7c.png") ElseIf c3 = 8 Then card3.Image = Image.FromFile("8c.png") ElseIf c3 = 9 Then card3.Image = Image.FromFile("9c.png") ElseIf c3 = 10 Then card3.Image = Image.FromFile("10c.png") ElseIf c3 = 11 Then card3.Image = Image.FromFile("jc.png") ElseIf c3 = 12 Then card3.Image = Image.FromFile("qc.png") ElseIf c3 = 13 Then card3.Image = Image.FromFile("kc.png") 'Diamonds Start (14 to 26) ElseIf c3 = 14 Then card3.Image = Image.FromFile("ad.png") ElseIf c3 = 15 Then card3.Image = Image.FromFile("2d.png") ElseIf c3 = 16 Then card3.Image = Image.FromFile("3d.png") ElseIf c3 = 17 Then card3.Image = Image.FromFile("4d.png") ElseIf c3 = 18 Then card3.Image = Image.FromFile("5d.png") ElseIf c3 = 19 Then card3.Image = Image.FromFile("6d.png") ElseIf c3 = 20 Then card3.Image = Image.FromFile("7d.png") ElseIf c3 = 21 Then card3.Image = Image.FromFile("8d.png") ElseIf c3 = 22 Then card3.Image = Image.FromFile("9d.png") ElseIf c3 = 23 Then card3.Image = Image.FromFile("10d.png") ElseIf c3 = 24 Then card3.Image = Image.FromFile("jd.png") ElseIf c3 = 25 Then card3.Image = Image.FromFile("qd.png") ElseIf c3 = 26 Then card3.Image = Image.FromFile("kd.png") '27 to 39 is Hearts ElseIf c3 = 27 Then card3.Image = Image.FromFile("ah.png") ElseIf c3 = 28 Then card3.Image = Image.FromFile("2h.png") ElseIf c3 = 29 Then card3.Image = Image.FromFile("3h.png") ElseIf c3 = 30 Then card3.Image = Image.FromFile("4h.png") ElseIf c3 = 31 Then card3.Image = Image.FromFile("5h.png") ElseIf c3 = 32 Then card3.Image = Image.FromFile("6h.png") ElseIf c3 = 33 Then card3.Image = Image.FromFile("7h.png") ElseIf c3 = 34 Then card3.Image = Image.FromFile("8h.png") ElseIf c3 = 35 Then card3.Image = Image.FromFile("9h.png") ElseIf c3 = 36 Then card3.Image = Image.FromFile("10h.png") ElseIf c3 = 37 Then card3.Image = Image.FromFile("jh.png") ElseIf c3 = 38 Then card3.Image = Image.FromFile("qh.png") ElseIf c3 = 39 Then card3.Image = Image.FromFile("kh.png") ' 40 to 52 are spades ElseIf c3 = 40 Then card3.Image = Image.FromFile("as.png") ElseIf c3 = 41 Then card3.Image = Image.FromFile("2s.png") ElseIf c3 = 42 Then card3.Image = Image.FromFile("3s.png") ElseIf c3 = 43 Then card3.Image = Image.FromFile("4s.png") ElseIf c3 = 44 Then card3.Image = Image.FromFile("5s.png") ElseIf c3 = 45 Then card3.Image = Image.FromFile("6s.png") ElseIf c3 = 46 Then card3.Image = Image.FromFile("7s.png") ElseIf c3 = 47 Then card3.Image = Image.FromFile("8s.png") ElseIf c3 = 48 Then card3.Image = Image.FromFile("9s.png") ElseIf c3 = 49 Then card3.Image = Image.FromFile("10s.png") ElseIf c3 = 50 Then card3.Image = Image.FromFile("js.png") ElseIf c3 = 51 Then card3.Image = Image.FromFile("qs.png") ElseIf c3 = 52 Then card3.Image = Image.FromFile("ks.png") End If End Sub Public Sub dealcard4() If c4 = 1 Then card4.Image = Image.FromFile("ac.png") ElseIf c4 = 2 Then card4.Image = Image.FromFile("2c.png") ElseIf c4 = 3 Then card4.Image = Image.FromFile("3c.png") ElseIf c4 = 4 Then card4.Image = Image.FromFile("4c.png") ElseIf c4 = 5 Then card4.Image = Image.FromFile("5c.png") ElseIf c4 = 6 Then card4.Image = Image.FromFile("6c.png") ElseIf c4 = 7 Then card4.Image = Image.FromFile("7c.png") ElseIf c4 = 8 Then card4.Image = Image.FromFile("8c.png") ElseIf c4 = 9 Then card4.Image = Image.FromFile("9c.png") ElseIf c4 = 10 Then card4.Image = Image.FromFile("10c.png") ElseIf c4 = 11 Then card4.Image = Image.FromFile("jc.png") ElseIf c4 = 12 Then card4.Image = Image.FromFile("qc.png") ElseIf c4 = 13 Then card4.Image = Image.FromFile("kc.png") 'Diamonds Start (14 to 26) ElseIf c4 = 14 Then card4.Image = Image.FromFile("ad.png") ElseIf c4 = 15 Then card4.Image = Image.FromFile("2d.png") ElseIf c4 = 16 Then card4.Image = Image.FromFile("3d.png") ElseIf c4 = 17 Then card4.Image = Image.FromFile("4d.png") ElseIf c4 = 18 Then card4.Image = Image.FromFile("5d.png") ElseIf c4 = 19 Then card4.Image = Image.FromFile("6d.png") ElseIf c4 = 20 Then card4.Image = Image.FromFile("7d.png") ElseIf c4 = 21 Then card4.Image = Image.FromFile("8d.png") ElseIf c4 = 22 Then card4.Image = Image.FromFile("9d.png") ElseIf c4 = 23 Then card4.Image = Image.FromFile("10d.png") ElseIf c4 = 24 Then card4.Image = Image.FromFile("jd.png") ElseIf c4 = 25 Then card4.Image = Image.FromFile("qd.png") ElseIf c4 = 26 Then card4.Image = Image.FromFile("kd.png") '27 to 39 is Hearts ElseIf c4 = 27 Then card4.Image = Image.FromFile("ah.png") ElseIf c4 = 28 Then card4.Image = Image.FromFile("2h.png") ElseIf c4 = 29 Then card4.Image = Image.FromFile("3h.png") ElseIf c4 = 30 Then card4.Image = Image.FromFile("4h.png") ElseIf c4 = 31 Then card4.Image = Image.FromFile("5h.png") ElseIf c4 = 32 Then card4.Image = Image.FromFile("6h.png") ElseIf c4 = 33 Then card4.Image = Image.FromFile("7h.png") ElseIf c4 = 34 Then card4.Image = Image.FromFile("8h.png") ElseIf c4 = 35 Then card4.Image = Image.FromFile("9h.png") ElseIf c4 = 36 Then card4.Image = Image.FromFile("10h.png") ElseIf c4 = 37 Then card4.Image = Image.FromFile("jh.png") ElseIf c4 = 38 Then card4.Image = Image.FromFile("qh.png") ElseIf c4 = 39 Then card4.Image = Image.FromFile("kh.png") ' 40 to 52 are spades ElseIf c4 = 40 Then card4.Image = Image.FromFile("as.png") ElseIf c4 = 41 Then card4.Image = Image.FromFile("2s.png") ElseIf c4 = 42 Then card4.Image = Image.FromFile("3s.png") ElseIf c4 = 43 Then card4.Image = Image.FromFile("4s.png") ElseIf c4 = 44 Then card4.Image = Image.FromFile("5s.png") ElseIf c4 = 45 Then card4.Image = Image.FromFile("6s.png") ElseIf c4 = 46 Then card4.Image = Image.FromFile("7s.png") ElseIf c4 = 47 Then card4.Image = Image.FromFile("8s.png") ElseIf c4 = 48 Then card4.Image = Image.FromFile("9s.png") ElseIf c4 = 49 Then card4.Image = Image.FromFile("10s.png") ElseIf c4 = 50 Then card4.Image = Image.FromFile("js.png") ElseIf c4 = 51 Then card4.Image = Image.FromFile("qs.png") ElseIf c4 = 52 Then card4.Image = Image.FromFile("ks.png") End If End Sub Public Sub dealCard5() If c5 = 1 Then card5.Image = Image.FromFile("ac.png") ElseIf c5 = 2 Then card5.Image = Image.FromFile("2c.png") ElseIf c5 = 3 Then card5.Image = Image.FromFile("3c.png") ElseIf c5 = 4 Then card5.Image = Image.FromFile("4c.png") ElseIf c5 = 5 Then card5.Image = Image.FromFile("5c.png") ElseIf c5 = 6 Then card5.Image = Image.FromFile("6c.png") ElseIf c5 = 7 Then card5.Image = Image.FromFile("7c.png") ElseIf c5 = 8 Then card5.Image = Image.FromFile("8c.png") ElseIf c5 = 9 Then card5.Image = Image.FromFile("9c.png") ElseIf c5 = 10 Then card5.Image = Image.FromFile("10c.png") ElseIf c5 = 11 Then card5.Image = Image.FromFile("jc.png") ElseIf c5 = 12 Then card5.Image = Image.FromFile("qc.png") ElseIf c5 = 13 Then card5.Image = Image.FromFile("kc.png") 'Diamonds Start (14 to 26) ElseIf c5 = 14 Then card5.Image = Image.FromFile("ad.png") ElseIf c5 = 15 Then card5.Image = Image.FromFile("2d.png") ElseIf c5 = 16 Then card5.Image = Image.FromFile("3d.png") ElseIf c5 = 17 Then card5.Image = Image.FromFile("4d.png") ElseIf c5 = 18 Then card5.Image = Image.FromFile("5d.png") ElseIf c5 = 19 Then card5.Image = Image.FromFile("6d.png") ElseIf c5 = 20 Then card5.Image = Image.FromFile("7d.png") ElseIf c5 = 21 Then card5.Image = Image.FromFile("8d.png") ElseIf c5 = 22 Then card5.Image = Image.FromFile("9d.png") ElseIf c5 = 23 Then card5.Image = Image.FromFile("10d.png") ElseIf c5 = 24 Then card5.Image = Image.FromFile("jd.png") ElseIf c5 = 25 Then card5.Image = Image.FromFile("qd.png") ElseIf c5 = 26 Then card5.Image = Image.FromFile("kd.png") '27 to 39 is Hearts ElseIf c5 = 27 Then card5.Image = Image.FromFile("ah.png") ElseIf c5 = 28 Then card5.Image = Image.FromFile("2h.png") ElseIf c5 = 29 Then card5.Image = Image.FromFile("3h.png") ElseIf c5 = 30 Then card5.Image = Image.FromFile("4h.png") ElseIf c5 = 31 Then card5.Image = Image.FromFile("5h.png") ElseIf c5 = 32 Then card5.Image = Image.FromFile("6h.png") ElseIf c5 = 33 Then card5.Image = Image.FromFile("7h.png") ElseIf c5 = 34 Then card5.Image = Image.FromFile("8h.png") ElseIf c5 = 35 Then card5.Image = Image.FromFile("9h.png") ElseIf c5 = 36 Then card5.Image = Image.FromFile("10h.png") ElseIf c5 = 37 Then card5.Image = Image.FromFile("jh.png") ElseIf c5 = 38 Then card5.Image = Image.FromFile("qh.png") ElseIf c5 = 39 Then card5.Image = Image.FromFile("kh.png") ' 40 to 52 are spades ElseIf c5 = 40 Then card5.Image = Image.FromFile("as.png") ElseIf c5 = 41 Then card5.Image = Image.FromFile("2s.png") ElseIf c5 = 42 Then card5.Image = Image.FromFile("3s.png") ElseIf c5 = 43 Then card5.Image = Image.FromFile("4s.png") ElseIf c5 = 44 Then card5.Image = Image.FromFile("5s.png") ElseIf c5 = 45 Then card5.Image = Image.FromFile("6s.png") ElseIf c5 = 46 Then card5.Image = Image.FromFile("7s.png") ElseIf c5 = 47 Then card5.Image = Image.FromFile("8s.png") ElseIf c5 = 48 Then card5.Image = Image.FromFile("9s.png") ElseIf c5 = 49 Then card5.Image = Image.FromFile("10s.png") ElseIf c5 = 50 Then card5.Image = Image.FromFile("js.png") ElseIf c5 = 51 Then card5.Image = Image.FromFile("qs.png") ElseIf c5 = 52 Then card5.Image = Image.FromFile("ks.png") End If End Sub End Class