Advertisement
Guest User

Untitled

a guest
Jun 5th, 2018
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Public Class frmStart
  2.     Dim intcard1, intcard2, intScore As Integer
  3.     Private Sub BtnLow_Click(sender As Object, e As EventArgs) Handles btnLow.Click
  4.         intcard2 = getRandom()
  5.         Select Case intcard2
  6.             Case 1
  7.                 PicCard2.Image = My.Resources.C2
  8.             Case 2
  9.                 PicCard2.Image = My.Resources.C3
  10.             Case 3
  11.                 PicCard2.Image = My.Resources.C4
  12.             Case 4
  13.                 PicCard2.Image = My.Resources.C5
  14.             Case 5
  15.                 PicCard2.Image = My.Resources.C6
  16.             Case 6
  17.                 PicCard2.Image = My.Resources.C7
  18.             Case 7
  19.                 PicCard2.Image = My.Resources.C8
  20.             Case 8
  21.                 PicCard2.Image = My.Resources.C9
  22.             Case 9
  23.                 PicCard2.Image = My.Resources.C10
  24.             Case 10
  25.                 PicCard2.Image = My.Resources.CA
  26.             Case 11
  27.                 PicCard2.Image = My.Resources.CJ
  28.             Case 12
  29.                 PicCard2.Image = My.Resources.CQ
  30.             Case 13
  31.                 PicCard2.Image = My.Resources.CK
  32.  
  33.         End Select
  34.         If intcard1 < intcard2 Then
  35.             lblMessageBox.Text = "Good Job"
  36.             intScore += 1
  37.             lblScore.Text = intScore.ToString
  38.             intcard1 = intcard2
  39.             PicCard1.Image = PicCard2.Image
  40.             PicCard2.Image = Nothing
  41.         ElseIf intcard2 = intcard1 Then
  42.             lblMessageBox.Text = "You have Drew, Press Start to play again"
  43.             intcard1 = intcard2
  44.             PicCard1.Image = PicCard2.Image
  45.             PicCard2.Image = Nothing
  46.         Else
  47.             PicCard2.Show()
  48.             lblMessageBox.Text = "Maybe you'll get it next time, Press Start to play again"
  49.             intScore = 0
  50.         End If
  51.     End Sub
  52.     Private Sub BtnHigh_Click(sender As Object, e As EventArgs) Handles btnHigh.Click
  53.         intcard2 = getRandom()
  54.         Select Case intcard2
  55.             Case 1
  56.                 PicCard2.Image = My.Resources.C2
  57.             Case 2
  58.                 PicCard2.Image = My.Resources.C3
  59.             Case 3
  60.                 PicCard2.Image = My.Resources.C4
  61.             Case 4
  62.                 PicCard2.Image = My.Resources.C5
  63.             Case 5
  64.                 PicCard2.Image = My.Resources.C6
  65.             Case 6
  66.                 PicCard2.Image = My.Resources.C7
  67.             Case 7
  68.                 PicCard2.Image = My.Resources.C8
  69.             Case 8
  70.                 PicCard2.Image = My.Resources.C9
  71.             Case 9
  72.                 PicCard2.Image = My.Resources.C10
  73.             Case 10
  74.                 PicCard2.Image = My.Resources.CA
  75.             Case 11
  76.                 PicCard2.Image = My.Resources.CJ
  77.             Case 12
  78.                 PicCard2.Image = My.Resources.CQ
  79.             Case 13
  80.                 PicCard2.Image = My.Resources.CK
  81.  
  82.         End Select
  83.         If intcard2 > intcard1 Then
  84.             lblMessageBox.Text = "Good Job"
  85.             intScore += 1
  86.             lblScore.Text = intScore.ToString
  87.             intcard2 = intcard1
  88.             PicCard1.Image = PicCard2.Image
  89.             PicCard2.Image = Nothing
  90.         ElseIf intcard2 = intcard1 Then
  91.             lblMessageBox.Text = "You have Drew, Press Start to play again"
  92.             intcard2 = intcard1
  93.             PicCard1.Image = PicCard2.Image
  94.             PicCard2.Image = Nothing
  95.         Else
  96.             PicCard2.Show()
  97.             lblMessageBox.Text = "Maybe you'll get it next time, Press Start to play again"
  98.             intScore = 0
  99.         End If
  100.     End Sub
  101.  
  102.     Private Sub btnReturn_Click(sender As Object, e As EventArgs) Handles btnReturn.Click
  103.         frmabout.Show()
  104.         Me.Hide()
  105.     End Sub
  106.  
  107.     Private Sub btnStart_Click(sender As Object, e As EventArgs) Handles btnStart.Click
  108.  
  109.         PicCard2.Hide()
  110.  
  111.         intcard1 = getRandom()
  112.  
  113.         Select Case intcard1
  114.             Case 1
  115.                 PicCard1.Image = My.Resources.C2
  116.             Case 2
  117.                 PicCard1.Image = My.Resources.C3
  118.             Case 3
  119.                 PicCard1.Image = My.Resources.C4
  120.             Case 4
  121.                 PicCard1.Image = My.Resources.C5
  122.             Case 5
  123.                 PicCard1.Image = My.Resources.C6
  124.             Case 6
  125.                 PicCard1.Image = My.Resources.C7
  126.             Case 7
  127.                 PicCard1.Image = My.Resources.C8
  128.             Case 8
  129.                 PicCard1.Image = My.Resources.C9
  130.             Case 9
  131.                 PicCard1.Image = My.Resources.C10
  132.             Case 10
  133.                 PicCard1.Image = My.Resources.CA
  134.             Case 11
  135.                 PicCard1.Image = My.Resources.CJ
  136.             Case 12
  137.                 PicCard1.Image = My.Resources.CQ
  138.             Case 13
  139.                 PicCard1.Image = My.Resources.CK
  140.  
  141.         End Select
  142.  
  143.     End Sub
  144.  
  145.     Public Function getRandom() As Integer
  146.  
  147.         Randomize()
  148.  
  149.         Dim randomNum = CInt(Int(13 - 1 + 1) * Rnd() + 1)
  150.         Return randomNum
  151.  
  152.     End Function
  153. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement