Xboxerdude
Member
- Joined
- Jul 6, 2008
- Sythe Gold
- 0
- Messages
- 41
Public Class mainForm
Private Wins As Integer = 0
Private Losses As Integer = 0
Private Ties As Integer = 0
Private Total As Integer = 0
Private Perc As Double
Private Sub exitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exitButton.Click
' close mainform
Me.Close()
End Sub
Private Sub rockPictureBox_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rockPictureBox.Click
Dim randomGenerator As New Random
Dim computerChoice As Integer
playerPictureBox.Image = rockPictureBox.Image
computerChoice = randomGenerator.Next(1, 4)
Select Case computerChoice
Case 1
computerPictureBox.Image = rockPictureBox.Image
winnerLabel.Text = "Tie"
Ties = Ties + 1
total = total + 1
Case 2
computerPictureBox.Image = paperPictureBox.Image
winnerLabel.Text = "Computer wins because paper covers rock."
Losses = Losses + 1
total = total + 1
Case 3
computerPictureBox.Image = scissorsPictureBox.Image
winnerLabel.Text = "Player wins because rock breaks scissors."
wins = wins + 1
total = total + 1
End Select
winTextBox.Text = Wins
LossTextBox.Text = Losses
tieTextbox.Text = Ties
TotalTextBox.Text = Total
Perc = Wins / Total
percentTextBox.Text = FormatPercent(Perc)
End Sub
Private Sub paperPictureBox_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles paperPictureBox.Click
Dim randomGenerator As New Random
Dim computerChoice As Integer
playerPictureBox.Image = paperPictureBox.Image
computerChoice = randomGenerator.Next(1, 4)
Select Case computerChoice
Case 1
computerPictureBox.Image = paperPictureBox.Image
winnerLabel.Text = "Tie"
Ties = Ties + 1
Total = Total + 1
Case 2
computerPictureBox.Image = rockPictureBox.Image
winnerLabel.Text = "Player wins because paper covers rock."
Wins = Wins + 1
Total = Total + 1
Case 3
computerPictureBox.Image = scissorsPictureBox.Image
winnerLabel.Text = "Computer wins because scissors cuts paper."
Losses = Losses + 1
Total = Total + 1
End Select
End Sub
Private Sub scissorsPictureBox_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles scissorsPictureBox.Click
Dim randomGenerator As New Random
Dim computerChoice As Integer
playerPictureBox.Image = scissorsPictureBox.Image
computerChoice = randomGenerator.Next(1, 4)
Select Case computerChoice
Case 1
computerPictureBox.Image = scissorsPictureBox.Image
winnerLabel.Text = "Tie"
Ties = Ties + 1
Total = Total + 1
Case 2
computerPictureBox.Image = paperPictureBox.Image
winnerLabel.Text = "Player wins because scissors cut paper."
Wins = Wins + 1
Total = Total + 1
Case 3
computerPictureBox.Image = rockPictureBox.Image
winnerLabel.Text = "Computer wins because rock breaks scissors."
Losses = Losses + 1
Total = Total + 1
End Select
End Sub
Private Sub resetButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles resetButton.Click
winTextBox.Text = ""
LossTextBox.Text = ""
tieTextbox.Text = ""
TotalTextBox.Text = ""
percentTextBox.Text = ""
End Sub
End Class
Private Wins As Integer = 0
Private Losses As Integer = 0
Private Ties As Integer = 0
Private Total As Integer = 0
Private Perc As Double
Private Sub exitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exitButton.Click
' close mainform
Me.Close()
End Sub
Private Sub rockPictureBox_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rockPictureBox.Click
Dim randomGenerator As New Random
Dim computerChoice As Integer
playerPictureBox.Image = rockPictureBox.Image
computerChoice = randomGenerator.Next(1, 4)
Select Case computerChoice
Case 1
computerPictureBox.Image = rockPictureBox.Image
winnerLabel.Text = "Tie"
Ties = Ties + 1
total = total + 1
Case 2
computerPictureBox.Image = paperPictureBox.Image
winnerLabel.Text = "Computer wins because paper covers rock."
Losses = Losses + 1
total = total + 1
Case 3
computerPictureBox.Image = scissorsPictureBox.Image
winnerLabel.Text = "Player wins because rock breaks scissors."
wins = wins + 1
total = total + 1
End Select
winTextBox.Text = Wins
LossTextBox.Text = Losses
tieTextbox.Text = Ties
TotalTextBox.Text = Total
Perc = Wins / Total
percentTextBox.Text = FormatPercent(Perc)
End Sub
Private Sub paperPictureBox_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles paperPictureBox.Click
Dim randomGenerator As New Random
Dim computerChoice As Integer
playerPictureBox.Image = paperPictureBox.Image
computerChoice = randomGenerator.Next(1, 4)
Select Case computerChoice
Case 1
computerPictureBox.Image = paperPictureBox.Image
winnerLabel.Text = "Tie"
Ties = Ties + 1
Total = Total + 1
Case 2
computerPictureBox.Image = rockPictureBox.Image
winnerLabel.Text = "Player wins because paper covers rock."
Wins = Wins + 1
Total = Total + 1
Case 3
computerPictureBox.Image = scissorsPictureBox.Image
winnerLabel.Text = "Computer wins because scissors cuts paper."
Losses = Losses + 1
Total = Total + 1
End Select
End Sub
Private Sub scissorsPictureBox_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles scissorsPictureBox.Click
Dim randomGenerator As New Random
Dim computerChoice As Integer
playerPictureBox.Image = scissorsPictureBox.Image
computerChoice = randomGenerator.Next(1, 4)
Select Case computerChoice
Case 1
computerPictureBox.Image = scissorsPictureBox.Image
winnerLabel.Text = "Tie"
Ties = Ties + 1
Total = Total + 1
Case 2
computerPictureBox.Image = paperPictureBox.Image
winnerLabel.Text = "Player wins because scissors cut paper."
Wins = Wins + 1
Total = Total + 1
Case 3
computerPictureBox.Image = rockPictureBox.Image
winnerLabel.Text = "Computer wins because rock breaks scissors."
Losses = Losses + 1
Total = Total + 1
End Select
End Sub
Private Sub resetButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles resetButton.Click
winTextBox.Text = ""
LossTextBox.Text = ""
tieTextbox.Text = ""
TotalTextBox.Text = ""
percentTextBox.Text = ""
End Sub
End Class


