You are on page 1of 2

Public Class Form1

Dim Pdraw1 As Integer
Dim Pdraw2 As Integer
Dim Pdraw3 As Integer
Dim Cdraw1 As Integer
Dim Cdraw2 As Integer
Dim Cdraw3 As Integer
Dim Playertotal As Integer
Dim Computertotal As Integer

Private Sub PlayGameToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles PlayGameToolStripMenuItem.Click

Randomize()
Pdraw1 = Int(10 * Rnd() + 1)
Pdraw2 = Int(10 * Rnd() + 1)
Label2.Text = Pdraw1
Label3.Text = Pdraw2
Label4.Text = "0"
Label10.Text = "0"
Label9.Text = "0"
Label8.Text = "0"
Label6.Text = "0"
Label12.Text = "0"

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
Randomize()
Pdraw3 = Int(10 * Rnd() + 1)
Label4.Text = Pdraw3
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button2.Click
Cdraw1 = Int(10 * Rnd() + 1)
Cdraw2 = Int(10 * Rnd() + 1)
Cdraw3 = Int(10 * Rnd() + 1)
Label10.Text = Cdraw1
Label9.Text = Cdraw2
Label8.Text = Cdraw3
Computertotal = Cdraw1 + Cdraw2 + Cdraw3
Label12.Text = Computertotal
Playertotal = Int(Label2.Text) + Int(Label3.Text) + Int(Label4.Text)
Label6.Text = Playertotal

If Playertotal > Computertotal And Playertotal <= 21 Then
MessageBox.Show("Player wins!")
End If
If Computertotal > Playertotal And Computertotal <= 21 Then
MessageBox.Show("Computer wins!")
End If
If Computertotal = Playertotal Then
MessageBox.Show("Draw!")
End If
End Sub
Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ExitToolStripMenuItem.Click
End
End Sub

End Class